Add updating shared memory logic