First working implementation of document_atomic_add