Fix tests.
Remove some duplication.
Merge pull request #14 from ejholmes/tests

Fix tests.