Implemented Sort functionality for the schedual