Get rid of extra sorts for efficiency