Fixed unintentional leaks

All functions inside the modules were leaking to global scope. This has been fixed.