Merge sort by due date and starred into one function