add basic memory logic