Done with first round of refactoring