Implement the sort by