finally got the scheduler working