Added optimistic locking