Working scheduler, slightly modified