Fixes issues #29, #30
Fixes issues #24
Merge pull request #32 from mattzuba/master

PR to fix #24, #29 and #30