Feature/moar tests and random cleanups

On the drive from Chicago-land back home, I took a crappy stab at a few more tests to the functions. They aren't all-inclusive or complete, but they add more coverage than previously existed and for me all pass. Please give them a test!

cc: @brutasse