Fixes #10, #5, #7