     end
   end
 
+  defp equal_names?(a, b) do
+    filter_for_comparison(a) == filter_for_comparison(b)
+  end
+
   defp filter_for_comparison(string) do
     string
     |> String.trim()
-    |> String.downcase()
+    |> String.upcase()
     |> String.normalize(:nfd)
     |> String.replace(~r/[^A-z\s]/u, "")
   end

      iex> countries = ISO.countries([:with_subdivisions])
      iex> countries["PR"]
      nil
  """
  @spec countries([atom()]) :: %{String.t() => String.t()}
  def countries(opts \\ []) do
    with_subdivisions? = :with_subdivisions in opts

    Enum.reduce(@iso, %{}, fn {code, %{"name" => name} = country}, acc ->
      cond do
        with_subdivisions? and country["subdivisions"] == %{} -> acc
        true -> Map.put(acc, code, name)
      end
    end)
  end


        |> Enum.find(fn {_subdivision_code, %{"name" => full_subdivision} = s} ->
          variation = s["variation"]

          equal_names?(full_subdivision, subdivision) or
            (is_binary(variation) and equal_names?(variation, subdivision))
        end)
        |> case do
          nil -> nil
