Fixes issues #29, #30
Fixes issue #24