updated to copy to shared memory