first version of the scheduler