Completed Chapter 9.3.4 Partial refactoring