anchor.diff:  %% gen_fsm states
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   
  -%% @private
  +%See if we have work. If we do, dispatch.
  +%If we don't, stay in at_rest.
  +%% @private
  +at_rest(timeout, State) ->
  +  case get_work(State) of
  +    no_work ->
  +      {next_state, at_rest, State};
  +    {ok, Work, NewState} ->
  +      ok = gen_fsm:send_event(self(), Work),
  +      {next_state, at_rest, NewState}
  +  end;
  +at_rest({get_async, {HandleEvent, AsyncMode}, Args, From},
  +        State = #{pid := Pid}) ->
  +  StreamRef = do_http_verb(get, Pid, Args),
  +  CleanState = clean_state(State),
  +  NewState = CleanState#{
  +               from => From,
  +               pid => Pid,
  +               stream => StreamRef,
  +               handle_event => HandleEvent,
  +               async => true,
  +               async_mode => AsyncMode
  +              },
  +  {next_state, wait_response, NewState};
  +at_rest({HttpVerb, Args, From}, State = #{pid := Pid}) ->
  +  StreamRef = do_http_verb(HttpVerb, Pid, Args),
  +  CleanState = clean_state(State),
  +  NewState = CleanState#{
  +               pid => Pid,
  +               stream => StreamRef,
  +               from => From
  +              },
  +  {next_state, wait_response, NewState}.
  +
   -spec at_rest(term(), pid(), term()) -> term().
  -at_rest({get_async, {HandleEvent, AsyncMode}, Args}, From, #{pid := Pid}) ->
  -    StreamRef = do_http_verb(get, Pid, Args),
  -    CleanState = clean_state(),
  -    NewState = CleanState#{
  -                 from => From,
  -                 pid => Pid,
  -                 stream => StreamRef,
  -                 handle_event => HandleEvent,
  -                 async => true,
  -                 async_mode => AsyncMode
  -                },
  -    {next_state, wait_response, NewState};
  -at_rest({HttpVerb, Args}, From, #{pid := Pid}) ->
  -    StreamRef = do_http_verb(HttpVerb, Pid, Args),
  -    CleanState = clean_state(),
  -    NewState = CleanState#{
  -                 pid => Pid,
  -                 stream => StreamRef,
  -                 from => From
  -                },
  -    {next_state, wait_response, NewState}.
  +at_rest(Event, From, State) ->
  +  enqueue_work_or_stop(at_rest, Event, From, State).
  +
  +%% @private
  +-spec wait_response(term(), pid(), term()) -> term().
  +wait_response(Event, From, State) ->
  +  enqueue_work_or_stop(wait_response, Event, From, State).
   
   %% @private
   -spec wait_response(term(), term()) -> term().
  
positive.code:     NewState = manage_chunk(IsFin, StreamRef, Data, State),
      case IsFin of
          fin ->
              {next_state, at_rest, NewState};
          nofin ->
              {next_state, receive_chunk, NewState}
      end;
  receive_chunk({gun_error, _Pid, _StreamRef, _Reason}, State) ->
      {next_state, at_rest, State}.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% Private
  
negative.code: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  %% @private
  -spec init([term()]) -> {ok, at_rest, map()}
                          | {stop, gun_open_timeout} | {stop, gun_open_failed}.
  init([Host, Port, Type, Opts]) ->
      GunType = case Type of
                    http -> tcp;
  