anchor.diff:      {next_state, shutdown, State}.
   
   handle_event({checkin, Pid}, shutdown, #state{monitors=Monitors0} = State) ->
  -    Monitors = lists:keydelete(Pid, 1, Monitors0),
  +    Monitors = demonitor_worker(Pid, Monitors0),
       case Monitors of
           [] -> %% work all done, time to exit!
               {stop, shutdown, State};
           _ ->
               {next_state, shutdown, State#state{monitors=Monitors}}
       end;
  -handle_event({checkin, Worker}, _, #state{pool = Pool, queue=Q, monitors=Monitors0} = State) ->
  -    Monitors = lists:keydelete(Worker, 1, Monitors0),
  +handle_event({checkin, Worker}, _, #state{pool = Pool, queue=Q, monitors=Monitors} = State) ->
       case queue:out(Q) of
           {{value, {work, Work, From}}, Rem} ->
               case poolboy:checkout(Pool, false) of
  
positive.code:                             monitors=NewMonitors}}
              end;
          {empty, Empty} ->
              {next_state, ready, State#state{queue=Empty, monitors=Monitors}}
      end;
  handle_event(_Event, StateName, State) ->
      {next_state, StateName, State}.
  
negative.code:             [{Worker, Ref, From, Work} | Monitors]
      end.
  
  demonitor_worker(Worker, Monitors) ->
      case lists:keyfind(Worker, 1, Monitors) of
          {Worker, Ref, _From, _Work} ->
              erlang:demonitor(Ref),
              lists:keydelete(Worker, 1, Monitors);
          false ->
              %% not monitored?
              Monitors
      end.
  
  discard_queued_work(Q) ->
      case queue:out(Q) of
          {{value, {work, _Work, From}}, Rem} ->
  