Chapter 9 refactoring