anchor.diff:                         pooler:return_member(riak_pool, Pid),
                          false
                  end,
  -    {Response, Req, Pid}.
  +    {Response, Req, State}.
       
   %% if pooler says no members, kick back a 503. I
   %% do this here because a 503 seems to me the most
   %% appropriate response if database connections are
   %% <b>currently</b> unavailable.
  -service_available(Req, error_no_members) ->
  +service_available(Req, {error_no_members, _}) ->
       {false, Req, undefined};
  -service_available(Req, Pid) ->
  +service_available(Req, State) ->
  +    {Pid, _opts} = State,
       Available = case nebula2_riak:ping(Pid) of
           true -> true;
           _ -> false
       end,
  -    {Available, Req, Pid}.
  -
  -to_cdmi_capability(Req, Pid) ->
  -    to_cdmi_object(Req, Pid).
  -
  -to_cdmi_container(Req, Pid) ->
  -    to_cdmi_object(Req, Pid).
  -
  -to_cdmi_object(Req, Pid) ->
  +    {Available, Req, State}.
  +
  +to_cdmi_capability(Req, State) ->
  +    to_cdmi_object(Req, State).
  +
  +to_cdmi_container(Req, State) ->
  +    to_cdmi_object(Req, State).
  +
  +to_cdmi_domain(Req, State) ->
  +    to_cdmi_object(Req, State).
  +
  +to_cdmi_object(Req, State) ->
  +    {Pid, _Opts} = State,
       {Path, _} = cowboy_req:path(Req),
       Uri = string:substr(binary_to_list(Path), 6),
       Response = case nebula2_riak:search(Pid, Uri) of
  
positive.code:          content_types_provided/2,
           from_cdmi_capability/2,
           from_cdmi_container/2,
           from_cdmi_object/2,
           forbidden/2,
           is_authorized/2,
           malformed_request/2,
           resource_exists/2,
           rest_init/2,
           service_available/2,
           to_cdmi_capability/2,
           to_cdmi_container/2,
           to_cdmi_object/2]).
  
  init(_, _Req, _Opts) ->
  
negative.code: 
  rest_init(Req, _State) ->
      PoolMember = pooler:take_member(riak_pool),
      {ok, Req, {PoolMember, []}}.
  
  content_types_accepted(Req, State) ->
      {[{{<<"application">>, <<"cdmi-capability">>, '*'}, from_cdmi_capability},
        {{<<"application">>, <<"cdmi-container">>, '*'}, from_cdmi_container},
        {{<<"application">>, <<"cdmi-object">>, '*'}, from_cdmi_object}
       ], Req, State}.
  
  content_types_provided(Req, State) ->
      {[{{<<"application">>, <<"cdmi-capability">>, '*'}, to_cdmi_capability},
        {{<<"application">>, <<"cdmi-container">>, '*'}, to_cdmi_container},
        {{<<"application">>, <<"cdmi-domain">>, '*'}, to_cdmi_domain},
        {{<<"application">>, <<"cdmi-object">>, '*'}, to_cdmi_object}
       ], Req, State}.
  
  forbidden(Req, State) ->
  %% TODO: Check ACLs here
      {false, Req, State}.
  %%    {true, Req, State}.
      
  from_cdmi_capability(Req, State) ->
      {Pid, _Opts} = State,
      lager:debug("from_cdmi_capability...~p", [Pid]),
      {Path, _} = cowboy_req:path_info(Req),
      lager:debug("URI: ~p", [Path]),
      {ok, Body, Req2} = cowboy_req:body(Req),
      lager:debug("Body: ~p", [Body]),
      pooler:return_member(riak_pool, Pid),
      {<<"{\"jsondoc\": \"number1\"}">>, Req2, State}.
  
  from_cdmi_container(Req, State) ->
      {Pid, _Opts} = State,
      lager:debug("from_cdmi_container...~p", [Pid]),
      {Path, _} = cowboy_req:path_info(Req),
      lager:debug("URI: ~p", [Path]),
      {ok, Body, Req2} = cowboy_req:body(Req),
      lager:debug("Body: ~p", [Body]),
      pooler:return_member(riak_pool, Pid),
      {<<"{\"jsondoc\": \"number1\"}">>, Req2, State}.
  
  from_cdmi_domain(Req, State) ->
      {<<"{\"jsondoc\": \"domain\"}">>, Req, State}.
  
  from_cdmi_object(Req, State) ->
      {Pid, _Opts} = State,
      lager:debug("from_cdmi_object...~p", [Pid]),
      {Path, _} = cowboy_req:path(Req),
  %%    Uri = string:substr(binary_to_list(Path), 6),
  