refactoring problem 3