Rewritten dependencies cycle detection algorithm to be recursion based.
Non-recursive algorithm had too big time and space complexity penalties.