Fixed unintentional leaks

All functions inside the modules were leaking to global scope. This has been fixed.
Merge pull request #1 from ofsortz/patch-1

Fixed unintentional leaks.