Refactor Scheduler class