Remove redundant key comparisons