code up to chapter 9