first round of refactoring