Improve dependency calculation.