Changed locks to only initialize for leaf nodes with accumulators. This is the only place locks are used.