fixes and improvements for chapter 3 and 4
NM halfway through chapter 5
Merge pull request #5 from pkelly03/master

merging upstream