Fixes issues #12, #13, #14