Exercise 56 and refactoring