A bit of renaming, and fixed potential resource leaks.
Merge pull request #1 from lare96/master

A bit of renaming, and fixed potential resource leaks.