More tests, and DRYing things up