finnished refactoring