improving performance by using pass variable to skip shared memory.