Add WriteMemory functionality