Fixes issues #29, #30
Fixes issues #24