Modified dependency extractor to avoid infininte loops