Simplified the memory management.