anchor.diff:              {stop, {done, results(S)}};
           {error, Reason} ->
               {stop, {error, Reason}}
  -    end;
  -
  -do_handle({Type, _Body}, _S) ->
  -    {error, {fatal, ["Unknown message type:", Type]}}.
  +    end.
   
   input_reply(Inputs) ->
       {"INP", [<<"done">>, [[Iid, <<"ok">>, Repl] || {Iid, Repl} <- Inputs]]}.
  
positive.code: 
  do_handle({<<"INP">>, [<<"exclude">>, Iids]}, #state{inputs = Inputs} = S) ->
      {ok, input_reply(worker_inputs:exclude(Iids, Inputs)), S};
  
  do_handle({<<"INP">>, _}, _S) ->
      {stop, {fatal, "Invalid INP request"}};
  
  do_handle({<<"EREP">>, [Iid, Rids]}, #state{inputs = Inputs} = S) ->
      Inputs1 = worker_inputs:fail(Iid, Rids, Inputs),
  
negative.code: 
  payload_type(_Type) -> none.
  
  handle({Type, Body}, S) ->
     case catch mochijson2:decode(Body) of
          {'EXIT', _} ->
              Err = ["Payload is not valid JSON: type '", Type, "', body:\n", Body],
              {error, {fatal, Err}};
          Json ->
              case payload_type(Type) of
                  none ->
                      Err = ["Unknown message type '", Type, "', body:\n", Body],
                      {error, {fatal, Err}};
                  Spec ->
                      case json_validator:validate(Spec, Json) of
                          ok ->
                              do_handle({Type, Json}, S);
                          {error, E} ->
                              Msg = "Invalid message body (type '~s'): ~p",
                              {error, {fatal, io_lib:format(Msg, [Type, E])}}
                      end
              end
      end.
  
  do_handle({<<"PID">>, Pid}, S) ->
  