Wrote code for scheduling