This comment is pretty far from the implementation, and I would rather see details like this closer to the implementation. This seems like pretty verbose "pseudocode" in the sense that it's note quite self documenting, so I would recommend making up function to replace all the `atomically` blocks that are self-describing.