adding a functionality to choose the sort order