Sort condition is now apply as part of the sorting, which makes it much more
efficient.