anchor.diff:  db_req(#httpd{path_parts=[_,<<"_missing_revs">>]}=Req, _Db) ->
       send_method_not_allowed(Req, "POST");
   
  -db_req(#httpd{method='PUT',path_parts=[_,<<"_admins">>]}=Req,
  -        Db) ->
  -    Admins = chttpd:json_body(Req),
  -    ok = ?COUCH:set_admins(Db, Admins),
  +db_req(#httpd{method='POST',path_parts=[_,<<"_revs_diff">>]}=Req, Db) ->
  +    {JsonDocIdRevs} = couch_httpd:json_body_obj(Req),
  +    {ok, Results} = fabric:get_missing_revs(Db, JsonDocIdRevs),
  +    Results2 =
  +    lists:map(fun({Id, MissingRevs, PossibleAncestors}) ->
  +        {Id,
  +            {[{missing, couch_doc:revs_to_strs(MissingRevs)}] ++
  +                if PossibleAncestors == [] ->
  +                    [];
  +                true ->
  +                    [{possible_ancestors,
  +                        couch_doc:revs_to_strs(PossibleAncestors)}]
  +                end}}
  +    end, Results),
  +    send_json(Req, {Results2});
  +
  +db_req(#httpd{path_parts=[_,<<"_revs_diff">>]}=Req, _Db) ->
  +    send_method_not_allowed(Req, "POST");
  +
  +db_req(#httpd{method='PUT',path_parts=[_,<<"_security">>]}=Req, Db) ->
  +    SecObj = couch_httpd:json_body(Req),
  +    ok = fabric:set_security(Db, SecObj),
       send_json(Req, {[{<<"ok">>, true}]});
   
  -db_req(#httpd{method='GET',path_parts=[_,<<"_admins">>]}=Req, Db) ->
  -    send_json(Req, ?COUCH:get_admins(Db));
  -
  -db_req(#httpd{path_parts=[_,<<"_admins">>]}=Req, _Db) ->
  +db_req(#httpd{method='GET',path_parts=[_,<<"_security">>]}=Req, Db) ->
  +    send_json(Req, fabric:get_security(Db));
  +
  +db_req(#httpd{path_parts=[_,<<"_security">>]}=Req, _Db) ->
       send_method_not_allowed(Req, "PUT,GET");
   
   db_req(#httpd{method='PUT',path_parts=[_,<<"_revs_limit">>]}=Req,
           Db) ->
       Limit = chttpd:json_body(Req),
  -    ok = ?COUCH:set_revs_limit(Db, Limit),
  +    ok = fabric:set_revs_limit(Db, Limit),
       send_json(Req, {[{<<"ok">>, true}]});
   
   db_req(#httpd{method='GET',path_parts=[_,<<"_revs_limit">>]}=Req, Db) ->
  -    send_json(Req, ?COUCH:get_revs_limit(Db));
  +    send_json(Req, fabric:get_revs_limit(Db));
   
   db_req(#httpd{path_parts=[_,<<"_revs_limit">>]}=Req, _Db) ->
       send_method_not_allowed(Req, "PUT,GET");
  +
  +% vanilla CouchDB sends a 301 here, but we just handle the request
  +db_req(#httpd{path_parts=[DbName,<<"_design/",Name/binary>>|Rest]}=Req, Db) ->
  +    db_req(Req#httpd{path_parts=[DbName, <<"_design">>, Name | Rest]}, Db);
   
   % Special case to enable using an unencoded slash in the URL of design docs,
   % as slashes in document IDs must otherwise be URL encoded.
  
positive.code: % Attachment request handlers
  
  db_attachment_req(#httpd{method='GET'}=Req, Db, DocId, FileNameParts) ->
      FileName = list_to_binary(mochiweb_util:join(lists:map(fun binary_to_list/1, FileNameParts),"/")),
      #doc_query_args{
          rev=Rev,
          options=Options
  
negative.code:                         list_to_binary(CType)
                      end,
                  data = fabric:att_receiver(Req, chttpd:body_length(Req)),
                  att_len = case couch_httpd:header_value(Req,"Content-Length") of
                      undefined ->
                          undefined;
                      Length ->
  