Rebased previously reverted merge, just before this scheduler refactoring. Auto commit by PR queue bot