Scheduler logic