changed to loop detection script to remove a modulo call