Fixed the component finding function

Still a bug in the cycleRecursion function :(