finish refactoring