Debugged and optimized AllDiff detector pattern