Fixes #9 and #6