refactoring problem 8