Chapter 9 Exercises: Some refactoring