Merge pull request #18 from benweet/master

Looks good. Thanks!
Added regression tests for issue #17
Fix formatting issues.
Merge remote-tracking branch 'upstream/master'