Refactor a lot of things