detecting_cycles added