various fixes to get the tests to pass
Merge pull request #60 from WriteOrRead/refactor

various fixes to get the tests to pass