Fixes #2, #6, #7