finished implementing sort functions, plus overdue flag