Simplify dependencyDetection to not check for duplicates; move duplicate check to addDependency. This approach doesn't benefit from the "hybrid" duplicate check, but I think the simplification will be faster.