Refactoring, tests