Started playing with macros
Made tests pass
Some cleanup
Merge pull request #8 from aidansteele/master

use a macro to cut down on duplication of code