Fix for leaked globals
Merge pull request #2 from Heyride/master

Fixing leaked globals