Merge pull request #188 from trevorbernard/master

Various improvements
Issue #191 - Generates excess garbage on close