fix #49, fix #54
Cleaned up the code a bit.
Merge pull request #56 from mmarsman1/development

fix #49, fix #54