anchor.diff:  	inet:setopts(Socket, [{active, once}]),
   	{noreply, NewState};
   
  -handle_info({udp, Socket, Ip, InPortNo, Packet}, #state{udp_socket = Socket,
  -	udp_remote_info = undefined} = State) ->
  -		#state{cookie = Cookie} = State,
  +handle_info({udp, Socket, Ip, InPortNo, Packet},
  +	#state{udp_socket = Socket, udp_remote_info = undefined} = State) ->
  +		#state{cookie = Cookie, aes_key = AESKey, aes_vector = AESVector} = State,
   		Success = try begin
  -			Json = mochijson2:decode(Socket),
  +			% Decrypt message
  +			Decrypted = crypto:aes_cbc_128_decrypt(AESKey, AESVector, Packet),
  +			% Strip padding added by OpenSSL's AES algorithm.
  +			PaddingByteCount = binary:last(Decrypted),
  +			Cleaned = binary:part(Decrypted, 0, byte_size(Decrypted) - PaddingByteCount),
  +			% Decode JSON message
  +			Json = mochijson2:decode(Cleaned),
   			Rec = json_to_envelope(Json),
  -			#envelope{channel = "control", contents = {struct, Event}} = Rec,
  -			case proplists:get_value(<<"cookie">>, Event) of
  -				Cookie -> ok;
  -				_ -> badcookie
  -			end end
  +			#envelope{type = request, channel = <<"control">>, id = MsgID, contents = {struct, Request}} = Rec,
  +			case proplists:get_value(<<"type">>, Request) of
  +				<<"connect">> ->
  +					case proplists:get_value(<<"cookie">>, Request) of
  +						Cookie -> ok;
  +						_ -> badcookie
  +					end;
  +				_ -> badrequest
  +			end end,
  +			% Send response over SSL transport
  +			ConnectRep = {struct, [
  +				{confirm, true}
  +			]},
  +			Response = #envelope{type = response, channel = <<"control">>, id = MsgID, contents = ConnectRep},
  +			OutBin = wrap_for_send(Response),
  +			SendRes = ssl:send(State#state.ssl_socket, OutBin),
  +			?debug("UDP connection response ssl:send result:  ~p", [SendRes])
   		catch
   			What:Why ->
   				{What,Why}
   		end,
   		case Success of
   			ok ->
  +				% Record this client's information in ETS
   				ClientRec = #client_connection{
   					pid = self(),
   					ssl_socket = State#state.ssl_socket,
  
positive.code: 					udp_socket = {Ip, InPortNo}
  				},
  				ets:insert(client_ets, ClientRec),
  				State0 = State#state{udp_remote_info = {Ip, InPortNo}},
  				?info("Udp port sync up:  ~p:~p", [Ip, InPortNo]),
  				inet:setopts(Socket, [{active, once}]),
  
negative.code: 		channel = <<"control">>},
  	OutBin = wrap_for_send(Response),
  	SendRes = ssl:send(State#state.ssl_socket, OutBin),
  	?debug("Login response ssl:send result:  ~p", [SendRes]),
  	% Record login information in state
  	AESKey = base64:decode(proplists:get_value(<<"key">>, Request)),
  	AESVector = base64:decode(proplists:get_value(<<"vector">>, Request)),
  	State#state{
  