tested refactoring