Add tests and cleanup code
Merge pull request #1 from kahnjw/cleanup

Add tests and cleanup code