Now also checks for cycles, almost

Does not yet work, somehow it does not regonize the name of the function in line 33???
NOT YET TESTED