     end
   end
 
-  defp downgrade_directives(v1, v2, m, beam) do
+  defp downgrade_directives(beam, v1, v2, m) do
     case is_supervisor(beam) do
       true ->
-        downgrade_directives_supervisor(v1, v2, m, beam)
+        downgrade_directives_supervisor(beam, v1, v2, m)
       false ->
         case has_code_change(beam) do
           true  -> [ { :update, m, :infinity, { :advanced, [] }, :brutal_purge, :brutal_purge, [] } ]

  defp beam_exports(beam, func, arity) do
    case :beam_lib.chunks(beam, [ :exports ]) do
      { :ok, { _, [ { :exports, exports } ] } } ->
        :lists.member({ func, arity }, exports)
      _ ->
        false
    end

    modules
  end

  defp upgrade_directives(beam, v1, v2, m) do
    case is_supervisor(beam) do
      true ->
        upgrade_directives_supervisor(beam, v1, v2, m)
      false ->
        case has_code_change(beam) do
          true  -> [ { :update, m, :infinity, { :advanced, [] }, :brutal_purge, :brutal_purge, [] } ]
