finished with refactoring