final refactoring