anchor.diff:                               [{pid_groups_join_as, DHTNodeGroup, wpool}]).
   
   -spec on(message(), state()) -> state().
  +%% new job arrives...either start it right away or queue it
   on({do_work, Source, Workload}, {Max, Working, Waiting}) when
           length(Working) >= Max ->
       {Max, Working, lists:append(Waiting, [{Source, Workload}])};
   on({do_work, Source, Workload}, State) ->
       start_worker(Source, Workload, State);
   
  +%% worker terminated; clear it from the working list and do error reporting if
  +%% necessarry
   on({'DOWN', _Ref, process, Pid, Reason}, State) ->
       ?TRACE("worker finished with reason ~p~n", [Reason]),
       %% TODO in case of error send some report back
       cleanup_worker(Pid, State);
   
  +%% worker sends results; forward to source
   on({data, Pid, Data}, {_Max, Working, _Waiting} = State) ->
       ?TRACE("wpool: received data from ~p:~n~p...~n",
               [Pid, lists:sublist(Data, 4)]),
  
positive.code: 
  -type(job() :: mr_job() | generic_job()).
  
  -type(active_jobs() :: [job()]).
  
  -type(waiting_jobs() :: [job()]).
  
  -type(state() :: {MaxWorkers::pos_integer(), active_jobs(), waiting_jobs()}).
  
  
negative.code:             State
      end.
  
  %% monitor worker and put it into the Working queue
  -spec monitor_worker(pid(), comm:my_pid(), state()) -> state().
  monitor_worker(Pid, Source, {Max, Working, Waiting}) ->
      monitor(process, Pid),
      {Max, [{Pid, Source} | Working], Waiting}.
  
  %% remove worker from Working queue and start a waiting job if present
  -spec cleanup_worker(pid(), state()) -> state().
  cleanup_worker(Pid, {Max, Working, Waiting}) ->
      NewWorking = lists:keydelete(Pid, 1, Working),
      case length(Waiting) of
  