Refactor Scheduler