add a mode variable to differentiate the three types of schedule