Scheduler C++ rewrite