anchor.diff:          in_process=InProcess}) ->
       try binary_to_term(Data) of
           's' ->
  -            case InProcess of
  -                {switch, From, Timer} ->
  -                    gen_fsm:cancel_timer(Timer),
  -                    gen_fsm:reply(From, ok),
  -                    check_queue(StateName, State);
  -                {call, _From, _Timer} ->
  -                    {stop, unexpected_response, State};
  -                undefined ->
  -                    {stop, orphan_response, State}
  -            end;
  +            handle_response(switch, ok, State, StateName);
           {'r', Result} ->
  -            case InProcess of
  -                {call, From, Timer} ->
  -                    gen_fsm:cancel_timer(Timer),
  -                    gen_fsm:reply(From, {ok, Result}),
  -                    check_queue(StateName, State);
  -                {switch, _From, _Timer} ->
  -                    {stop, unexpected_response, State};
  -                undefined ->
  -                    {stop, orphan_response, State}
  -            end;
  +            handle_response(call, {ok, Result}, State, StateName);
           {'e', Result} ->
  -            case InProcess of
  -                {call, From, Timer} ->
  -                    gen_fsm:cancel_timer(Timer),
  -                    gen_fsm:reply(From, {error, Result}),
  -                    check_queue(StateName, State);
  -                {switch, _From, _Timer} ->
  -                    {stop, unexpected_response, State};
  -                undefined ->
  -                    {stop, orphan_response, State}
  -            end;
  -        _ ->
  -            % Ignore possible call requests
  -            {next_state, StateName, State}
  +            handle_response(call, {error, Result}, State, StateName)
       catch
           error:badarg ->
               case InProcess of
  -                {call, From, _Timer} ->
  +                {_, From, _Timer} ->
                       gen_fsm:reply(From, {error, invalid_response});
  -                _ ->
  +                undefined ->
                       ok
               end,
               {stop, invalid_response, State}
  
positive.code:     {call, From, Data};
  queued({switch, From}, Data) ->
      {switch, From, Data}.
  
negative.code:             {next_state, StateName, State#state{queue=Queue2}}
      end.
  
  request({call, From}, Timer) ->
      {call, From, Timer};
  request({switch, From}, Timer) ->
  