the scheduler implemention