added scheduleData as argument to function