Refactoring a bunch of things