anchor.diff:      {keep_state_and_data, [{reply, From, {ok, Data}}]};
   
   handle_event({call, From}, {set_ssid, {RadioId, WlanId} = WlanIdent, SSID, SuppressSSID},
  -	     run, #data{config = Config0} = Data0) ->
  +	     run, #data{id = CommonName, config = Config0} = Data0) ->
       Settings = [{ssid, SSID}, {suppress_ssid, SuppressSSID}],
       Config = update_wlan_config(RadioId, WlanId, Settings, Config0),
       Data1 = Data0#data{config = Config},
   
  -    AddResponseFun = fun(Code, _, DData) ->
  -			     lager:debug("AddResponseFun: ~w", [Code]),
  -			     case Code of
  -				 0 -> gen_statem:reply(From, ok);
  -				 _ -> gen_statem:reply(From, {error, Code})
  -			     end,
  -			     DData
  -		     end,
  +    AddResponseFun =
  +	fun(Code, _, DData) ->
  +		lager:debug("Add WLAN response for ~p: ~p", [CommonName, Code]),
  +		case Code of
  +		    0 -> gen_statem:reply(From, ok);
  +		    _ -> gen_statem:reply(From, {error, Code})
  +		end,
  +		DData
  +	end,
   
       Data =
   	case get_wlan(WlanIdent, Data1) of
  
positive.code:     sendto(Header, PayLoad, Data),
      keep_state_and_data;
  
  handle_event(cast, {ieee_802_11_wlan_configuration_response, _Seq,
  		    #{result_code := #result_code{result_code = 0}} = Elements,
  		    _Header},
  	     run, #data{data_channel_address = WTPDataChannelAddress, id = CommonName,
  		       config = Config, wlans = Wlans} = Data0) ->
      lager:debug("IEEE 802.11 WLAN Configuration ok for ~p", [CommonName]),
  
      BSSIdIEs = get_ies(ieee_802_11_assigned_wtp_bssid, Elements),
      Data1 = Data0#data{config = Config#wtp{broken_add_wlan_workaround = (BSSIdIEs =:= [])}},
  
      if (BSSIdIEs == [] andalso length(Wlans) /= 1) ->
  	    %% no BSS Id and multiple Wlans, this can not work, error out
  	    lager:error("~p: WTP with broken Add WLAN Response and multiple WLAN is not working", [CommonName]);
         BSSIdIEs == [] ->
  	    %% no BSS Ids means the WTP is broken, activate workaround
  	    lager:warning("~p: WTP with broken Add WLAN Response, upgrade as soon as possible", [CommonName]);
         true ->
  	    ok
      end,
  
      Data = lists:foldl(
  	     fun(#ieee_802_11_assigned_wtp_bssid{
  		    radio_id = RadioId,
  		    wlan_id = WlanId,
  		    bssid = BSS}, S0) ->
  		     update_wlan_state({RadioId, WlanId},
  				       fun(W = #wlan{vlan = VlanId}) ->
  					       capwap_dp:add_wlan(WTPDataChannelAddress,
  								  RadioId, WlanId, BSS, VlanId),
  					       W#wlan{bss = BSS}
  				       end, S0)
  	     end, Data1, BSSIdIEs),
      {keep_state, Data};
  
  handle_event(cast, {ieee_802_11_wlan_configuration_response, _Seq,
  		    #{result_code := #result_code{result_code = Code}},
  		    _Header},
  	     run, #data{id = CommonName}) ->
      lager:warning("IEEE 802.11 WLAN Configuration failed for ~p with ~w", [CommonName, Code]),
      %% TODO: handle Update failures
      {keep_state_and_data};
  
  handle_event(cast, {station_configuration_response, _Seq,
  		    #{result_code := #result_code{result_code = 0}}, _Header}, run, _Data) ->
      lager:debug("Station Configuration ok"),
      keep_state_and_data;
  handle_event(cast, {station_configuration_response, _Seq,
  		    #{result_code := #result_code{result_code = Code}}, _Header}, run, _Data) ->
      %% TODO: timeout and Error handling,
      %% e.g. shut the station process down when the Add Station failed
      lager:warning("Station Configuration failed with ~w", [Code]),
      keep_state_and_data;
  
  handle_event(cast, {configuration_update_response, _Seq,
  		    #{result_code := #result_code{result_code = 0}}, _Header}, run, _Data) ->
      lager:debug("Configuration Update ok"),
  
negative.code:     Wlan = get_wlan_by_bss(BSS, Data0),
      lager:warning("WLAN: ~p", [Wlan]),
      Data = internal_add_station(Wlan, MAC, StaCaps, CryptoData,
  				internal_add_station_response_fun(From), Data0),
      {keep_state, Data};
  
  handle_event({call, From}, {get_station_config, BSS}, run, Data) ->
  