Fixed dependency resolution to not be quadratic.