refactoring, tests