Add locks for the operations, and go fmt