Use atomics for tag number.
Some more polishing.