Only process dependencies once

Simplifies the process by only doing it once will make it a bit faster
and also the cleanup afterwards.