   defp get_apps(nil, acc), do: Enum.uniq(acc)
   defp get_apps({:error, _} = err, _acc), do: err
   defp get_apps(%App{} = app, acc) do
-    new_acc = app.applications
-    |> Enum.concat(app.included_applications)
-    |> Enum.reduce([app|acc], fn
-      {:error, _} = err, _acc ->
-        err
-      {a, load_type}, acc ->
-        case Enum.any?(acc, fn %App{name: ^a} -> true; _ -> false end) do
-          true -> acc
-          false ->
+    new_acc =
+      app.applications
+      |> Enum.concat(app.included_applications)
+      |> Enum.reduce([app|acc], fn
+        {:error, _} = err, _acc ->
+          err
+        {a, load_type}, acc ->
+          if Enum.any?(acc, fn %App{name: app} -> a == app end) do
+            acc
+          else
             case App.new(a, load_type) do
               nil ->
                 acc
               %App{} = app ->
                 case get_apps(app, acc) do
-                  {:error, _} = err -> err
-                  children -> Enum.concat(acc, children)
+                  {:error, _} = err ->
+                    err
+                  children ->
+                    Enum.concat(acc, children)
                 end
               {:error, _} = err ->
                 err
             end
-        end
-      a, acc ->
-        case Enum.any?(acc, fn %App{name: ^a} -> true; _ -> false end) do
-          true -> acc
-          false ->
+          end
+        a, acc ->
+          if Enum.any?(acc, fn %App{name: app} -> a == app end) do
+            acc
+          else
             case App.new(a) do
               nil ->
                 acc
               %App{} = app ->
                 case get_apps(app, acc) do
-                  {:error, _} = err -> err
-                  children -> Enum.concat(acc, children)
+                  {:error, _} = err ->
+                    err
+                  children ->
+                    Enum.concat(acc, children)
                 end
               {:error, _} = err ->
                 err
             end
-        end
-    end)
+          end
+      end)
     case new_acc do
-      {:error, _} = err -> err
-      apps -> Enum.uniq(apps)
+      {:error, _} = err ->
+        err
+      apps ->
+        Enum.uniq(apps)
     end
   end
 

  def is_erts_lib?(app_dir, lib_dir), do: String.starts_with?(app_dir, lib_dir)

  @doc false
  def newline() do
    case :os.type() do
      {:win32, _} -> "\r\n"
      {:unix, _}  -> "\n"
    end
  end

end

  """
  @spec detect_erts_version(String.t) :: {:ok, Stringt} | {:error, term}
  def detect_erts_version(path) when is_binary(path) do
    entries =
      path
      |> Path.expand
      |> Path.join("erts-*")
      |> Path.wildcard
      |> Enum.map(&Path.basename/1)
    case entries do
      [<<"erts-", vsn::binary>>] ->
        {:ok, vsn}
