Added classes and optimistic locking