first step of refactoring complete