refactored Scheduler