anchor.diff:      {reply, ets:info(State#state.tab, size), State};
   
   handle_call({get_proc, #doc{body={Props}}=DDoc, DDocKey}, From, State) ->
  +    {Client, _} = From,
       Lang = couch_util:get_value(<<"language">>, Props, <<"javascript">>),
  -    IterFun = fun(Proc0, Acc) ->
  -        case lists:member(DDocKey, Proc0#proc.ddoc_keys) of
  +    IterFun = fun(Proc, Acc) ->
  +        case lists:member(DDocKey, Proc#proc.ddoc_keys) of
               true ->
  -                {Client, _} = From,
  -                Proc = Proc0#proc{client = erlang:monitor(process, Client)},
  -                ets:insert(State#state.tab, Proc),
  -                {stop, Proc};
  +                {stop, assign_proc(State#state.tab, Client, Proc)};
               false ->
                   {ok, Acc}
           end
       end,
       TeachFun = fun(Proc0, Acc) ->
           try
  -            {ok, Proc} = teach_ddoc(DDoc, DDocKey, Proc0),
  -            {stop, Proc}
  +            {ok, Proc1} = teach_ddoc(DDoc, DDocKey, Proc0),
  +            {stop, assign_proc(State#state.tab, Client, Proc1)}
           catch _:_ ->
               {ok, Acc}
           end
  
positive.code: 
  
  
  iter_procs(Tab, Lang, Fun, Acc) when is_list(Lang) ->
      iter_procs(Tab, list_to_binary(Lang), Fun, Acc);
  iter_procs(Tab, Lang, Fun, Acc) ->
      Pattern = #proc{lang=Lang, client=nil, _='_'},
      MSpec = [{Pattern, [], ['$_']}],
  
negative.code:     unlink(Pid),
      {ok, Proc}.
  
  assign_proc(Tab, Client, #proc{client=nil}=Proc0) ->
      Proc = Proc0#proc{client = erlang:monitor(process, Client)},
      ets:insert(Tab, Proc),
      Proc.
  
  get_query_server_config() ->
      Limit = couch_config:get("query_server_config", "reduce_limit", "true"),
      {[{<<"reduce_limit">>, list_to_atom(Limit)}]}.
  