       @base_path
       |> File.ls!()
       |> Enum.each(fn id_string ->
-          root = Path.join(@base_path, id_string)
-          with {:ok, id} <- PrettyId.cast(id_string),
-                entry <- get_entry_by_id(id)
-          do
-            case entry do
-              nil ->
+        root = Path.join(@base_path, id_string)
+
+        with {:ok, id} <- PrettyId.cast(id_string),
+             entry <- get_entry_by_id(id) do
+          case entry do
+            nil ->
+              File.rm_rf!(root)
+              :ok
+
+            {:finished, _error, last_accessed} ->
+              if :os.system_time(:second) - last_accessed >= minutes_old * 60 do
                 File.rm_rf!(root)
-                :ok
-              {:finished, _error, last_accessed} ->
-                if :os.system_time(:second) - last_accessed >= minutes_old * 60 do
-                  File.rm_rf!(root)
-                  delete_entry_by_id(id)
-                end
-                :ok
-              _ ->
-                :ok
-            end
-          else
+                delete_entry_by_id(id)
+              end
+
+              :ok
+
             _ ->
               :ok
           end
-        end)
-        :unit
+        else
+          _ ->
+            :ok
+        end
+      end)
+
+      :unit
     else
       :unit
     end


      _ ->
        put_entry(revision, :working)
        task = fn -> Task.async fn -> do_compile(revision) end end
        {:started, task}
    end
  end

  end

  defp get_entry(revision) do
    Agent.get(__MODULE__, fn state -> Map.get(state, revision.id) end)
  end

  defp get_entry_by_id(id) do
    Agent.get(__MODULE__, fn state -> Map.get(state, id) end)
  end

  defp put_entry(revision, status) do
    Agent.update(__MODULE__, fn state -> Map.put(state, revision.id, status) end)
  end

  defp delete_entry_by_id(id) do
    Agent.update(__MODULE__, fn state -> Map.delete(state, id) end)
  end
end
