Rewrote find_cycles to be better!