Optimize comparisons