       # 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)
+        remove_and_purge(beam, module)
         {rest, Map.put(stale, module, true), Map.put(removed, source, true)}
 
       # If I have a runtime time dependency on something stale,

        into: %{}
  end

  ## Manifest handling

  defp read_manifest(manifest) do

      {: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
