in reply to (Hopefully) simple sorting question

Briefly, your sort-comparison function will consider x first, and then consider y only when the values of x are equal.   You also may need to do a little magic (e.g. “<” vs.lt”) to be certain that the comparison being performed is, in fact, a numeric one.   Test thoroughly.