Trying to make these counters thread safe