plugging in the loop-detection algo