Changed to use couchdb as database