sorty by due and priority

thanks to @StephanHoyer for helping out