Fixes issues #3 to #7