Shared memory version - not functionally correct