Added SetMemory function