Improved tests

A picture is worth a thousand words:

![screen shot 2013-10-09 at 12 25 49 pm](https://f.cloud.github.com/assets/1702745/1299274/80376654-30ff-11e3-9854-a242a42e6a4b.jpg)

I also refactored the code to be easier for others to write their own tests.