         other -> other
       end
     end
-    change_impl_for(t, protocol, types, structs, is_protocol, [{:attribute, line, :spec, {{:__protocol__, 1}, newspecs}}|acc])
-  end
-
-  defp change_impl_for([h | t], protocol, info, types, is_protocol, acc) do
-    change_impl_for(t, protocol, info, types, is_protocol, [h | acc])
-  end
-
-  defp change_impl_for([], protocol, _info, _types, is_protocol, acc) do
-    if is_protocol do
+    change_impl_for(tail, protocol, types, structs, protocol?, [{:attribute, line, :spec, {{:__protocol__, 1}, new_specs}} | acc])
+  end
+
+  defp change_impl_for([head | tail], protocol, info, types, protocol?, acc) do
+    change_impl_for(tail, protocol, info, types, protocol?, [head | acc])
+  end
+
+  defp change_impl_for([], protocol, _info, _types, protocol?, acc) do
+    if protocol? do
       {:ok, {protocol, Enum.reverse(acc)}}
     else
       {:error, :not_a_protocol}


    call_args = :lists.map(fn i -> {String.to_atom(<<?x, i + 64>>), [], __MODULE__} end,
                           :lists.seq(2, arity))
    call_args = [quote(do: t) | call_args]

    quote do
      name  = unquote(name)

    end
  end

  defp change_impl_for([{:function, line, :__protocol__, 1, clauses} | tail], protocol, types, structs, _, acc) do
    clauses = :lists.map(fn
      {:clause, l, [{:atom, _, :consolidated?}], [], [{:atom, _, _}]} ->
        {:clause, l, [{:atom, 0, :consolidated?}], [], [{:atom, 0, true}]}
