Do first round of refactoring