added chapter 09 code from book