Deal with upstream issues

Closes tickets #7, #8 and #9 ; some minor-looking conflicts.