cleaned up memory.lua