implemented refactoring