More tests and a refactor to make testing easier.

Nice example of how, if some things were done using TDD, the initial
design would have been better.