Correctly handle concurrency