fix some bugs found with more testing, additional tests
more test coverage
Merge pull request #99 from JerrySievert/master

bug fixes and test coverage