 
   if (runWhenExit) {
     /* Request to load the sketch - do so */
-    loadSketchReset(filename);
-  } else {
-    /* Undo the setting of loading the sketch */
-    setLoadOptions(NULL, 0);
+    PHN_loadSketch(filename);
   }
 }
 

  }
}

void setLoadOptions(const char* sketchName, unsigned char options) {
  PHN_Settings settings;
  PHN_Settings_Load(settings);
  if (sketchName) {
    memcpy(settings.sketch_toload, sketchName, 8);
  } else {
    memcpy(settings.sketch_toload, settings.sketch_current, 8);
  }
  settings.flags &= ~(SETTINGS_LOAD | SETTINGS_LOADWIPE);
  settings.flags |= options;
  PHN_Settings_Save(settings);
}

void loadSketchReset(char* filename) {
  /* Clicked a sketch, load it */
  setLoadOptions(filename, SETTINGS_LOAD);

  /* Software reset using watchdog */
  WDTCSR=(1<<WDE) | (1<<WDCE);
  WDTCSR= (1<<WDE);
  for(;;);
}

/*
 * Used to draw an icon with text underneath it in a portable, re-usable manner.
 * x/y/w/h specifies the location and size of the icon drawn

          break;
        default:
          /* Clicked a sketch, load it */
          PHN_loadSketch(sketch_icon_text[touchedIndex]);
          break;
      }
    }
