added code up to (and including) chapter 10