 
   """
   @spec difference(t, t) :: t
-  def difference(%MapSet{} = set1, %MapSet{} = set2) do
-    reduce(set2, {:cont, set1}, fn value, acc ->
-      {:cont, delete(acc, value)}
-    end) |> elem(1)
+  def difference(%MapSet{map: map1}, %MapSet{map: map2}) do
+    map = :maps.fold(fn value, _, acc ->
+      Map.delete(acc, value)
+    end, map1, map2)
+    %MapSet{map: map}
   end
 
   @doc """

  """

  @opaque t :: %__MODULE__{map: map}
  defstruct map: %{}

  @doc """

  """
  @spec put(t, value) :: t
  def put(%MapSet{map: map} = set, value) do
    %{set | map: Map.put(map, value, true)}
  end

  @doc """
