Lots of little fixes, plus chapter 9 example.

This should be a class member variable, initialized above