Re-factored Scheduler::loop() for improved clarity.