adding chapter 9 code