     return STATE_WINDOW_EXITED;
   } 
 
+}
+
+STATE enterTempMaxMode(){
+  if(currentState != STATE_TEMP_MAX){
+    currentState = STATE_TEMP_MAX;
+    
+    changeMCBRelayState(false);
+    passFullCurrentThrough(false);
+    
+    changeDisplayBacklight(true);
+    shortBeepXTimesNoDelay(10);
+    Serial.println("Enter Max Temp mode");
+  }
+
+  float temperature = getTemperature();
+
+  if(temperature >= TEMP_MAX){
+    return STATE_TEMP_MAX; 
+  } else {
+    return STATE_WINDOW_BEFORE;  
+  }
 }
 
 void changeMCBRelayState(bool state){

    runningTotal += currentValue;
    samplesTaken++;
    
    static unsigned long lastDisplayTime;
    //We don't want to keep printing to screen as it is slow so we just do a running average
    if((currentTime - lastDisplayTime) >= INTERVAL_PRINT){
      float temperature = getTemperature();
  
      lastDisplayTime = currentTime;
      double average = runningTotal / samplesTaken;
  
      runningTotal = 0;

    case STATE_WINDOW_EXITED:
      nextState = enterWindowExitedMode(currentValue);
      break;
    case STATE_TEMP_MAX:
      nextState = enterTempMaxMode();
      break;
    default:
      Serial.println("Something is really wrong here, this mode should not exist!!!");
      break;
