Make sorting direction (ascending/descending) explicit in the UI and in the code. Instead of a boolean flag, two distinct "ascending" and "descending" options are used instead. This should be much clearer.