   lcd.print(versionString);
   delay(2000);
   lcd.clear();
+
+  motorUpdateTask.setInterval(delayBetweenMotorUpdates);
+  motorUpdateTask.onRun(SetMotorState);
+  motorUpdateTask.enabled = true;
+  taskController.add(&motorUpdateTask);
+
+  displayUpdateTask.setInterval(1000);
+  displayUpdateTask.onRun(UpdateDisplay);
+  displayUpdateTask.enabled = true;
+  taskController.add(&displayUpdateTask);
+
+  clockUpdateTask.setInterval(1000);
+  clockUpdateTask.onRun(UpdateClock);
+  clockUpdateTask.enabled = true;
+  taskController.add(&clockUpdateTask);  
 }
 
 void loop()
 {
   HandleInputs();
-  
-  SetMotorState();
-    
-  UpdateClock();
-  UpdateDisplay();
+  taskController.run();  
 }
 
 void HandleInputs()


void UpdateClock()
{   
  unsigned long now = millis();
  unsigned int timeSinceLastClockTick = now - lastClockTickTime;

  if (timeSinceLastClockTick > 1000)
  {
    lastClockTickTime = now;
    
    if (powerEnabled)
    {
      secondsOfOperation++;
      
      if (secondsOfOperation % 60 == 0)
      {
        WriteClock();
      }
    }
  }
}

void UpdateDisplay()
{
  unsigned long now = millis();
  unsigned int timeSinceLastDisplay = now - lastDisplayTime;

  // TODO: To avoid mistakes, maybe we should have a buffer that
  // contains boilerplate text for the whole display, then write
  // data to it in the appropriate places, and write the whole
  // buffer to the display.
  
  if (timeSinceLastDisplay > 1000)
  {
    lastDisplayTime = now;

    if (showDebugDisplay)
    {
      UpdateDebugDisplay();
    }
    else
    {
      UpdateRpmDisplay(now, timeSinceLastDisplay);
      UpdateDirectionDisplay();
      UpdateHoursDisplay();
    }
  }
}

void UpdateRpmDisplay(unsigned long now, unsigned int timeSinceLastDisplay)
{
  int totalMotorTicks = motorTicks;
  motorTicks = 0;

  // We get one pulse every 90 deg. of rotation
  float rpm = totalMotorTicks * 60 / 4.0 * (1000.0 / timeSinceLastDisplay);
  rpm /= gearRatio;

    targetSpeed = 0;
  }

  int newDelayBetweenMotorUpdates = ReadPotentiometer(rateOfSpeedChangeInPin);
  newDelayBetweenMotorUpdates = map(newDelayBetweenMotorUpdates, 0, potentiometerCeiling, minimumDelay, maximumDelay);
  int absoluteCurrentSpeed = abs(currentSpeed);
  if (absoluteCurrentSpeed > abs(targetSpeed) && absoluteCurrentSpeed < startOfStopDamping)
  {
