Fix for memory leak (and a few minor tweaks...)
Merge pull request #51 from grahamar/master

Fix for memory leak (and a few minor tweaks...)