Unify chapter4 with chapter 3.  Fixes #12
Merge pull request #15 from jsuereth/wip/unify-chapter-4

Unify chapter4 with chapter 3.