Added cyclic dependency detection