changed comparison operands from pairs to lists