Updated chapter 12 code to final