Sorting algorithms added for each bag