Implemented depth first search for schedules