Memory management added