Fixes #73 and #64, and addresses most of #71