refactoring problem 2