 SimpleTimer myTimer;
 int timerId, timerId2, timerId3;                          // reference to clock timer, light timer, and title timer
 String strTime, strLine2;
+String strTitleDisplay = strTitle;
+String strGradDisplay = strGrad;
+boolean bTimerDone = false;
 
 // Configure display and timer.
 void setup() {
   pinMode(lcdPin, OUTPUT);                                // set lcdPin as output to LCD
   pinMode(onBoardLEDPin, OUTPUT);                         // set onBoardLEDPin as output to LCD
   mySerial.begin(9600);                                   // start serial
-  timerId = myTimer.setInterval(1000, modifyClock);       // update clock every 1 sec
+  mySerial.write(22);                                     // no cursor
+  timerId = myTimer.setInterval(1000, updateClock);       // update clock time every 1 sec
   timerId2 = myTimer.setInterval(500, flashLED);          // flash light every 0.5 sec
-  timerId3 = myTimer.setInterval(500, updateTitle);       // update title every 0.5 sec
+  timerId3 = myTimer.setInterval(350, updateLCD);         // update lcd every 0.35 sec
   setupTime();                                            // setup time left
   delay(100);
   
   // pad title string with 16 whitespaces in the front
-  for (int i = 0; i < 16; i++) {
-     strTitle = " " + strTitle;
+  int padding = strTitle.length() % 16;
+  
+  // scroll left to right
+  for (int i = 0; i < padding; i++) {
+     strTitleDisplay = " " + strTitleDisplay;
+  }
+  
+  // pad title string with 16 whitespaces in the front
+  padding = strGrad.length() % 16;
+  
+  // scroll left to right
+  for (int i = 0; i < padding; i++) {
+     strGradDisplay = " " + strGradDisplay;
   }
 }
 

// Timer is done.
void onTimerEnd()
{
  mySerial.write(12);                   // clear
  mySerial.println(strTitle);           // first line, display title
  mySerial.write(148);                  // new line
  mySerial.print(strGrad);              // second line, display congrats
  Serial.println("Timer done!");        // console debug
}

// Setup time to count.

  m -= h * 60;
  
  // format DD:HH:MM:SS
  return formateClockTime(daysLeft, h, m, s);
}

// format DD:HH:MM:SS
String formateClockTime(int days, int hours, int minutes, int seconds) {
  return printDigits(days, true) + printDigits(hours, true) + printDigits(minutes, true) + printDigits(seconds, false);
}

/*
