added optimistic locks