anchor.diff:      {next_state, StateName, State};
   
   %% Rekey due to sent data limit reached?
  -handle_event(cast, data_size, {connected,Role}, #state{ssh_params=Ssh0} = State) ->
  -    {ok, [{send_oct,Sent0}]} = inet:getstat(State#state.socket, [send_oct]),
  -    Sent = Sent0 - State#state.last_size_rekey,
  -    MaxSent = proplists:get_value(rekey_limit, State#state.opts, 1024000000),
  +handle_event(cast, data_size, {connected,Role}, #data{ssh_params=Ssh0} = State) ->
  +    {ok, [{send_oct,Sent0}]} = inet:getstat(State#data.socket, [send_oct]),
  +    Sent = Sent0 - State#data.last_size_rekey,
  +    MaxSent = proplists:get_value(rekey_limit, State#data.opts, 1024000000),
   %%% FIXME: timer
       timer:apply_after(?REKEY_DATA_TIMOUT, gen_statem, cast, [self(), data_size]),
       case Sent >= MaxSent of
   	true ->
   	    {KeyInitMsg, SshPacket, Ssh} = ssh_transport:key_exchange_init_msg(Ssh0),
   	    send_bytes(SshPacket, State),
  -	    {next_state, {kexinit,Role,renegotiate}, State#state{ssh_params = Ssh,
  +	    {next_state, {kexinit,Role,renegotiate}, State#data{ssh_params = Ssh,
   								 key_exchange_init_msg = KeyInitMsg,
   								 last_size_rekey = Sent0}};
   	_ ->
  
positive.code:     send_bytes("Protocol mismatch.", S),
      {stop, {shutdown,"Protocol mismatch in version exchange."}};
  
  handle_event(_, {version_exchange,Version}, {hello,Role}, S=#state{ssh_params = Ssh0,
  								   socket = Socket,
  								   recbuf = Size}) ->
      {NumVsn, StrVsn} = ssh_transport:handle_hello_version(Version),
  
negative.code:     end;
  
  handle_event(info, {Protocol, Socket, "SSH-" ++ _ = Version}, StateName={hello,_},
  	     State=#data{socket = Socket,
  			  transport_protocol = Protocol}) ->
      {next_state, StateName, State,  [{next_event, internal, {version_exchange,Version}}]};
  
  handle_event(info, {Protocol, Socket, Info}, StateName={hello,_},
  	     State=#data{socket = Socket,
  			  transport_protocol = Protocol}) ->
      {next_state, StateName, State,  [{next_event, internal, {info_line,Info}}]};
  
  handle_event(info, {Protocol, Socket, Data}, StateName, State0 =
  		 #data{socket = Socket,
  			transport_protocol = Protocol,
  			decoded_data_buffer = DecData0,
  			encoded_data_buffer = EncData0,
  