     case {type, event, state} do
       {:cast, {:join, ip, port, token}, :wait_for_joins} ->
         MiaServer.Playerlist.join_player(ip, port, token)
-        {:keep_state, data}
+        :keep_state_and_data
       {:cast, {:invalid, ^currentip, _port, _msg}, :round} ->
-        data = player_lost_aftermath(data, "INVALID TURN")
-        {:next_state, :wait_for_registrations, data, {:state_timeout, @timeout, :check_registry}}
+        {:next_state, :wait_for_registrations, player_lost(data, "INVALID TURN"), {:state_timeout, @timeout, :check_registry}}
       {:cast, {:player_sees, ^currenttoken}, :round} ->
         {:next_state, :wait_for_registrations, handle_see(data), {:state_timeout, @timeout, :check_registry}}
       {:cast, {:player_rolls, ^currenttoken}, :round} ->

            playerip: nil,
            token: nil,
            action: nil,
            timer: nil,
            dice: nil,
            announced: nil,
            injected: nil

      MiaServer.Registry.increase_score(name)
    end
  end
  defp update_score(playerno, :won) do
    {_ip, _port, name} = MiaServer.Playerlist.get_participating_player(playerno)
    MiaServer.Registry.increase_score(name)
