Clean up the sorting code and make the comments consistent with what is
happening...