Refactor a lot of code, make use of components and React's context api