anchor.diff:      ACMonitor = erlang:monitor(process, AC),
   
       State = update_state_from_cfg(StationCfg, State0#state{ac = AC, ac_monitor = ACMonitor}),
  -    {reply, {ok, self()}, initial_state(MacMode), State, ?IDLE_TIMEOUT}.
  +    {next_state, initial_state(MacMode), State, [{reply, {ok, self}}, ?IDLE_TIMEOUT]}.
   
   %% partially en/decode Authentication Frames
   decode_auth_frame(<<Algo:16/little-integer, SeqNo:16/little-integer,
  
positive.code: 	_ ->
  	    %% send Auth Fail
  	    wtp_send_80211(gen_auth_fail(DA, SA, BSS, Frame), State),
  	    {next_state, init_auth, State, ?IDLE_TIMEOUT}
      end;
  
  init_auth(Event, State) ->
      lager:warning("in INIT_AUTH got unexpexted: ~p", [Event]),
      {next_state, init_auth, State, ?IDLE_TIMEOUT}.
  
  init_auth(Event, From, State)
    when element(1, Event) == take_over ->
      lager:debug("in INIT_AUTH got TAKE-OVER: ~p", [Event]),
      handle_take_over(Event, From, State);
  
  init_auth(Event, _From, State) when Event == detach; Event == delete ->
      {reply, {error, not_attached}, init_auth, State, ?IDLE_TIMEOUT}.
  
  %%
  %% State 2
  %%
  init_assoc(timeout, State) ->
      lager:warning("idle timeout in INIT_ASSOC"),
      {stop, normal, State};
  
  init_assoc(Event = {'Authentication', _DA, _SA, BSS, 0, 0, _Frame},
  	   State = #state{radio_mac = BSS, mac_mode = local_mac}) ->
      lager:debug("in INIT_ASSOC Local-MAC Mode got Authentication Request: ~p", [Event]),
      {next_state, init_assoc, State, ?IDLE_TIMEOUT};
  
  init_assoc(Event = {FrameType, _DA, _SA, BSS, 0, 0, Frame},
  	   State0 = #state{radio_mac = BSS, mac_mode = MacMode})
    when MacMode == local_mac andalso
         (FrameType == 'Association Request' orelse FrameType == 'Reassociation Request') ->
  
negative.code:     {error, unhandled}.
  
  handle_ieee802_3_frame(AC, RadioMAC, <<_EthDst:6/bytes, EthSrc:6/bytes, _/binary>> = Frame) ->
      with_station(AC, RadioMAC, EthSrc, gen_statem:cast(_, {'802.3', Frame}));
  handle_ieee802_3_frame(_, _, _Frame) ->
      {error, unhandled}.
  
  take_over(Pid, AC, StationCfg) ->
      gen_statem:call(Pid, {take_over, AC, StationCfg}).
  
  detach(ClientMAC) ->
      case capwap_station_reg:lookup(ClientMAC) of
  	{ok, Pid} ->
  	    gen_statem:call(Pid, detach);
  	_ ->
  	    not_found
      end.
  
  delete(Pid) when is_pid(Pid) ->
      gen_statem:call(Pid, delete).
  
  start_gtk_rekey(Station, Controller, GTK, IGTK) ->
      gen_statem:cast(Station, {start_gtk_rekey, Controller, GTK, IGTK}).
  
  %%%===================================================================
  %%% gen_statem callbacks
  %%%===================================================================
  callback_mode() ->
      state_functions.
  
  init([AC, ClientMAC, StationCfg = #station_config{bss = RadioMAC,
  						  mac_mode = MacMode}]) ->
      State0 = init_state_from_cfg(StationCfg),
  