Refactor cycle detector to prevent potential inf loop.
Refactor cycle detector to prevent potential inf loop.

snahelou/awx,snahelou/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,wwitzel3/awx,wwitzel3/awx