         into: %{}
   end
 
+  defp remove_and_purge(beam, module) do
+    _ = File.rm(beam)
+    _ = :code.purge(module)
+    _ = :code.delete(module)
+  end
+
   ## Manifest handling
 
   defp read_manifest(manifest) do

      # If I changed in disk or have a compile time dependency
      # on something stale, I need to be recompiled.
      Map.has_key?(removed, source) or Enum.any?(compile, &Map.has_key?(stale, &1)) ->
        _ = File.rm(beam)
        _ = :code.purge(module)
        _ = :code.delete(module)
        {rest, Map.put(stale, module, true), Map.put(removed, source, true)}

      # If I have a runtime time dependency on something stale,

      {:ok, [@manifest_vsn|data]} ->
        parse_manifest(data, keep_paths, state)
      {:ok, [:v2|data]} ->
        for {beam, module, _, _, _, _, _, _} <- data do
          remove_and_purge(beam, module)
        end
        state
      _ ->
        state
