Slightly optimized the schedule sorting.