finds cycles