 
           driver_name = :unicode.characters_to_binary(driver_name, :latin1, :utf8)
           driver_name = Regex.replace(~r/^.\. +/, driver_name, "")
+          driver_map = %{
+            "Alonso" => "alonso",
+            "Bottas" => "bottas",
+            "Button" => "button",
+            "Ericsson" => "ericsson",
+            "Grosjean" => "grosjean",
+            "Gutierrez" => "gutierrez",
+            "Hamilton" => "hamilton",
+            "Haryanto" => "haryanto",
+            "Hülkenberg" => "hulkenberg",
+            "Kwjat" => "kvyat",
+            "Magnussen" => "kevin_magnussen",
+            "Massa" => "massa",
+            "Nasr" => "nasr",
+            "Palmer" => "jolyon_palmer",
+            "Perez" => "perez",
+            "Räikkönen" => "raikkonen",
+            "Ricciardo" => "ricciardo",
+            "Rosberg" => "rosberg",
+            "Sainz" => "sainz",
+            "Vandoorne" => "vandoorne",
+            "Verstappen" => "max_verstappen",
+            "Vettel" => "vettel",
+            "Wehrlein" => "wehrlein"
+          }
+          driver_name = Map.get(driver_map, driver_name, driver_name)
+
           Map.put map, driver_name, tires
         _ -> map
       end


    qdata = get_qualy_results(year, round)

    File.write(data_filename, Poison.encode!(%{chart_data: chart_data, qdata: qdata, constructors: constructors, tire_data: tire_data}), [:binary])
    File.write("dd-f1-#{year}-#{round}.html", EEx.eval_file("laps.html.eex", [year: year, round: round, data_src: data_filename]))
  end


  def with_cached_file(filepath, func) do
    case File.exists? filepath do
      false ->
        IO.puts "Getting data..."
        data = func.()
        IO.puts "Putting data to file #{filepath}"
        File.write!(filepath, Poison.encode!(data), [:binary])
        data
      true ->
        IO.puts "Getting data from file #{filepath}"
        Poison.decode!(File.read!(filepath))
    end
  end

  def get_tire_data(year, round) do

    parsed["MRData"]["DriverTable"]["Drivers"]
  end

  def with_cached_file(filepath, func) do
    case File.exists? filepath do
      false ->
        IO.puts "Getting data..."
        data = func.()
        IO.puts "Putting data to file #{filepath}"
        File.write!(filepath, Poison.encode!(data), [:binary])
        data
      true ->
        IO.puts "Getting data from file #{filepath}"
        Poison.decode!(File.read!(filepath))
    end
  end



