 
 void loop() {
   if (sample) {
-    ref = readTemp();
+    int tt = readTemp();
     int tv = readVol();
-    if (ref > temp)
-      temp = ref;
+    if (tt > temp)
+      temp = tt;
     if (tv > vol)
       vol = tv;
     cycle++;

      if (Serial) {
        Serial.print(temp);
        Serial.print(" ");
        Serial.println(vol);
      }
      temp = 0;
      vol = 0;
    }
  } else {
    
    if (alarm && readTemp() <= ref + 5)
      cycle++;
    else if (!alarm && readTemp() > ref + 5)
      cycle++;
    else
      cycle = 0;

  return fahrenheit;
}

float readTemp() {
  return mlxRead(0x07);
}

float readAmb() {
  return mlxRead(0x06);
}

int readVol() {
  int readings[50], minR = 1023, maxR = 0;
  for (int i = 0; i < 50; i++) {
