completed refactoring