changed memory management