First part of couchdb integration