Refactoring chapter 9 samples