Refactored scheduler

it's a class now!!