chapter 19 refactor