Changed to reduce touching of shared memory.  This can give significant
performance improvements on multicores.