Fixes issues #16 and #14