working on the scheduler logic