solved refactoring problem