increased readabilty of memory management, fixed memory leak on unload