chapter 5 refactoring