Added has_cycle