 
     runtime_dispatches =
       runtime_dispatches
-      |> Enum.to_list
-
-    kind     = detect_kind(module)
-    source   = Path.relative_to(source, cwd)
+      |> Enum.to_list()
+
+    kind = detect_kind(module)
+    source = Path.relative_to(source, cwd)
     external = get_external_resources(module, cwd)
 
-    Agent.cast pid, fn {modules, sources} ->
-      source_external = case List.keyfind(sources, source, source(:source)) do
-        source(external: old_external) -> external ++ old_external
-        nil -> external
-      end
-
-      module_sources = case List.keyfind(modules, module, module(:module)) do
-        module(sources: old_sources) -> [source | List.delete(old_sources, source)]
-        nil -> [source]
-      end
-
-      new_module = module(
-        module: module,
-        kind: kind,
-        sources: module_sources,
-        beam: nil, # They are calculated when writing the manifest
-        binary: binary
-      )
-
-      new_source = source(
-        source: source,
-        size: :filelib.file_size(source),
-        compile_references: compile_references,
-        runtime_references: runtime_references,
-        compile_dispatches: compile_dispatches,
-        runtime_dispatches: runtime_dispatches,
-        external: source_external,
-        warnings: []
-      )
+    Agent.cast(pid, fn {modules, sources} ->
+      source_external =
+        case List.keyfind(sources, source, source(:source)) do
+          source(external: old_external) -> external ++ old_external
+          nil -> external
+        end
+
+      module_sources =
+        case List.keyfind(modules, module, module(:module)) do
+          module(sources: old_sources) -> [source | List.delete(old_sources, source)]
+          nil -> [source]
+        end
+
+      # They are calculated when writing the manifest
+      new_module =
+        module(
+          module: module,
+          kind: kind,
+          sources: module_sources,
+          beam: nil,
+          binary: binary
+        )
+
+      new_source =
+        source(
+          source: source,
+          size: :filelib.file_size(source),
+          compile_references: compile_references,
+          runtime_references: runtime_references,
+          compile_dispatches: compile_dispatches,
+          runtime_dispatches: runtime_dispatches,
+          external: source_external,
+          warnings: []
+        )
 
       modules = List.keystore(modules, module, module(:module), new_module)
       sources = List.keystore(sources, source, source(:source), new_source)
       {modules, sources}
-    end
+    end)
   end
 
   defp detect_kind(module) do

  end

  defp expand_beam_paths(modules, ""), do: modules
  defp expand_beam_paths(modules, compile_path) do
    Enum.map(modules, fn
      module() = module ->
        expand_beam_path(module, compile_path)
      other ->
        other
    end)

      # something stale, I need to be recompiled.
      has_any_key?(changed, sources) or has_any_key?(stale, compile_references) ->
        remove_and_purge(beam, module)

        {
          rest,
          Map.put(stale, module, true),
          Enum.reduce(sources, changed, &Map.put(&2, &1, true))
        }

      # If I have a runtime references to something stale,
      # I am stale too.
