This reverts c3a1eb62 (and the related commit f3c5278e) which makes cleanupAroundReplacements() no longer thread-safe.