Add tests and fix uncovered bugs.
Merge pull request #17 from rjnagal/tests

Add tests and fix uncovered bugs.