Fixes gh-5 and minor cleanup