   tft.println("37");
 }
 
-void settings_setup(){
-    alarm_button.draw();
-    createHLabel(265, 210, alarmLabel, 1, ILI9341_BLACK);
-    createHLabel(265, 220, settingsLabel, 1, ILI9341_BLACK);
-}
+void alarm_button_setup(void){
+  alarm_button.draw();
+  createHLabel(265, 210, alarmLabel, 1, ILI9341_BLACK);
+  createHLabel(265, 220, settingsLabel, 1, ILI9341_BLACK);
+}
+
+void confirm_button_setup(void){
+  confirm_button.draw();
+  createHLabel(9, 217, confirmLabel, 1, ILI9341_BLACK);
+}
+
+void default_button_setup(void){
+  default_button.draw();
+  createHLabel(BOXSIZE + 10, 217, defaultLabel, 1, ILI9341_BLACK);
+}
+
+void mode_button_setup(void){
+  mode_button.draw();
+  createHLabel(BOXSIZE*2 + 20, 217, modeLabel, 1, ILI9341_BLACK);
+}
+
+void cancel_button_setup(void){
+  cancel_button.draw();
+  createHLabel(BOXSIZE*3 + 14, 217, cancelLabel, 1, ILI9341_BLACK);
+}
+
 /*
  * clearScreen(int color) - clear screen with specified color
  */
 void clearScreen(int color){
-    tft.fillRect(BOXSIZE,0,tft.width()-BOXSIZE,tft.height(),color);
+    tft.fillRect(0,0,tft.width(),tft.height(),color);
+}
+
+void MainScreenInit(void){
+  clearScreen(ILI9341_BLACK);
+  product_title();  
+  ECG_setup();
+  sp02_setup();
+  //temperature_setup();
+  alarm_button_setup();
+}
+
+void SettingsScreenInit(void){
+  clearScreen(ILI9341_BLACK);
+  confirm_button_setup();
+  default_button_setup();
+  mode_button_setup();
+  cancel_button_setup();
+  tft.drawFastVLine(BOXSIZE, 200, 40, ILI9341_BLACK);
+  tft.drawFastVLine(BOXSIZE*2, 200, 40, ILI9341_BLACK);
+  tft.drawFastVLine(BOXSIZE*3, 200, 40, ILI9341_BLACK);
 }
 
 void setup(void){

  product_title();  
  ECG_setup();
  sp02_setup();
  temperature_setup();
  settings_setup();
}

void loop(void) {
  //timeout ++;
  // After timeout, wipe message from screen
  /*
  if (timeout > 50000) {
     clearScreen(ILI9341_BLACK);
	 product_title();
     timeout = 0;
  } */
  
  // Touch screen interfacing taken from touchpaint.ino example
  // in the ILI9341 examples directory
  ecg.read();
  // Check if there is touch data
  if (ts.bufferEmpty()){
    return;
  }
  // Retrieve the touch point
  TS_Point p = ts.getPoint();
  while(!ts.bufferEmpty()){
      TS_Point throwaway = ts.getPoint(); 
  }
  // Scale from 0-4000 to tft.width() using calibration numbers
  p.x = tft.height() - map(p.x, TS_MINX, TS_MAXX, 0, tft.height());
  p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.width());
  int temp = p.y;
  p.y = p.x;
  p.x = temp;
  
			// Debugging the analog read
            tft.setCursor((tft.width()/2) -50, tft.height()/2);
     		tft.setTextSize(2);
     		tft.setTextColor(ILI9341_RED);
			int num = analogRead(15);
			String readout = String(num);
			clearScreen(ILI9341_BLACK);
     		tft.println(readout); 
  // Do stuff with the coordinates of the touch
  /* 
  if (temp_button.isTapped(p.x,p.y)){
        if(!temp_button.lastTapped){
			// Debugging the analog read
            tft.setCursor((tft.width()/2) -50, tft.height()/2);
     		tft.setTextSize(2);
     		tft.setTextColor(ILI9341_RED);
			int num = analogRead(15);
			String readout = String(num);
			clearScreen(ILI9341_BLACK);
     		tft.println(readout); 
        }
  } else {
    temp_button.lastTapped = false;
  }
*/
  

}
  

char celLabel[] = "Cel";
char alarmLabel[] = "ALARM";
char settingsLabel[] = "SETTINGS";
char confirmLabel[] = "CONFIRM";
char defaultLabel[] = "DEFAULT";
char modeLabel[] = "MODE";
char cancelLabel[] = "CANCEL";

/*
 * create vertical labels
 */
