memory management added