Implementing sort ordering.