     delay(15);
     totalDelay += 15;
   }
-  return(totalDelay >= ATTRACT_MODE_TIMEOUT ? TITLE_TIMEOUT : selectedItem);
+  return (totalDelay >= ATTRACT_MODE_TIMEOUT ? TITLE_TIMEOUT : selectedItem);
 }
 
 byte titleMenuLeftButton(byte selectedItem) {
   /**
-   * Handle clicks on the left button
-   * to navigate through main menu
-   * items.
-   */
+     Handle clicks on the left button
+     to navigate through main menu
+     items.
+  */
   switch (selectedItem) {
-        
+
     case TITLE_SETTINGS:
-         arduboy.drawRect(76, 47, 51, 13, 0);
-         arduboy.drawRect(30, 47, 45, 13, 1);
-         arduboy.display();
-         return TITLE_CREDITS;
-         break; 
+      arduboy.drawRect(76, 47, 51, 13, 0);
+      arduboy.drawRect(30, 47, 45, 13, 1);
+      arduboy.display();
+      return TITLE_CREDITS;
+      break;
 
     case TITLE_CREDITS:
-         arduboy.drawRect(30, 47, 45, 13, 0);
-         arduboy.drawRect(2, 47, 26, 13, 1);
-         arduboy.display();
-         return  TITLE_PLAY_GAME;
-         break;
+      arduboy.drawRect(30, 47, 45, 13, 0);
+      arduboy.drawRect(2, 47, 26, 13, 1);
+      arduboy.display();
+      return  TITLE_PLAY_GAME;
+      break;
 
     default: break;
-  }  
-}
-
-
-byte titleMenuRightButton(byte selectedItem){
+  }
+}
+
+
+byte titleMenuRightButton(byte selectedItem) {
   /**
-   * Handle clicks on the right button
-   * to navigate through main menu 
-   * items.
-   */
+     Handle clicks on the right button
+     to navigate through main menu
+     items.
+  */
   switch (selectedItem) {
-        
+
     case TITLE_PLAY_GAME:
-         arduboy.drawRect(2, 47, 26, 13, 0);
-         arduboy.drawRect(30, 47, 45, 13, 1);
-         arduboy.display();
-         return TITLE_CREDITS;
-         break; 
+      arduboy.drawRect(2, 47, 26, 13, 0);
+      arduboy.drawRect(30, 47, 45, 13, 1);
+      arduboy.display();
+      return TITLE_CREDITS;
+      break;
 
     case TITLE_CREDITS:
-         arduboy.drawRect(30, 47, 45, 13, 0);
-         arduboy.drawRect(76, 47, 51, 13, 1);
-         arduboy.display(); 
-         return TITLE_SETTINGS; 
-         break;
-
-    default: break;      
+      arduboy.drawRect(30, 47, 45, 13, 0);
+      arduboy.drawRect(76, 47, 51, 13, 1);
+      arduboy.display();
+      return TITLE_SETTINGS;
+      break;
+
+    default: break;
   }
 }
 

// Main program loop
void loop() {
  byte result;
  
  // TODO alternate between titleScreen and highScoreScreen on a timer
  // until user pressed a button
  result = titleScreen();

  switch(result) {
    case TITLE_CREDITS:
      creditsScreen();
      break;

  if (arduboy.pressed(RIGHT_BUTTON) && (spaceShip.x < MAX_SHIP_X)) {
    spaceShip.x++;
  }

  if (arduboy.pressed(LEFT_BUTTON) && (spaceShip.x > MIN_SHIP_X)) {
    spaceShip.x--;
  }

  if (arduboy.pressed(UP_BUTTON)) {
    if (spaceShip.y > MIN_SHIP_X) {
      spaceShip.y--;
