Scheduler code refactoring
Scheduler code refactoring