         {_, player_info} ->
           build_player_view(player_info, false)
         end)
-      |> _sort_views()
+      |> sort_views()
     GenEvent.notify(state.broadcaster, {:player_views, player_views})
     state
   end

  end


  defp _sort_views(views) do
    views |> Enum.sort_by(fn
      %Tanx.Core.View.Player{name: name, is_me: is_me} -> {!is_me, name}
    end)
  end


  # Remove the calling player. Returns :ok (regardless of whether the caller was a player
  # that was removed or not).
  def handle_call(:player_left, {from, _}, state) do
    state = internal_remove_player(from, state)
    {:reply, :ok, state}
  end


  # Trap EXIT to handle the death of Player processes. If a Player dies, remove it.
  def handle_info({:EXIT, pid, _}, state) do
    {:noreply, internal_remove_player(pid, state)}
  end
  def handle_info(request, state), do: super(request, state)

