Cleanups
Implementing locking for batch updates