   cmdMessenger.feedinSerialData();
   
   if (currentMillis - previousMillis > 100) {
+    measureTemperature();
     temperaturePID.Compute();
     controlHeater();
-    temperature = measureTemperature();
     previousMillis = currentMillis;
     slowCount++;
     if (slowCount > 50) {
+      Serial << temperature << ENDMSG;
+      Serial << analogRead(A0) << ENDMSG;
       Serial << STATMSG << "Duty Cycle is " << dutyCycle << ENDMSG;
       slowCount = 0;
     }

  {
    index = adcMax;
  }
  int temperature = pgm_read_word(&temperatureTable[index]);
  return double(temperature)/10;
}

int temperatureToInt(double temperature) {
  return int(10*temperature);
}

unsigned long windowStartTime;

  char temp[5];
  itoa(temperatureToInt(temperature), temp, 10);
  cmdMessenger.sendCmd(kTEMPERATURE, temp);
  Serial << temperature;
}

void arduino_ready() {
  // In response to ping. We just send a throw-away ack to say "im alive"
  /* cmdMessenger.sendCmd(kSTATUS,"Arduino ready"); */
}

void unknownCmd()
{
  // Default response for unknown commands and corrupt messages
  /* cmdMessenger.sendCmd(kERR,"Unknown command"); */
}

void measureTemperature() {
  int index = analogRead(A0) - adcSubstract;
  if (index < 0)
  {
