Add locking mechanisms for improved concurrency