small reworking of the loop-breaker-choosing algorithm