Optimizations for the scheduler algorithm