Refactoring: Performance improvement for dependency check.