What if two threads hit the copy at the same time; whichever performs the replace last will overwrite other changes unless there is some kind of locking around the copy-add-replace. Am I missing something there?