 
   // make sure we are good for wifi
   if (WiFi.status() != WL_CONNECTED) {
-    Serial.print("Connecting to ");
-    Serial.println(ssid);
     WiFi.reconnect();
-
     if (WiFi.waitForConnectResult() != WL_CONNECTED) {
-      Serial.println("Failed to reconnect WIFI");
-      Serial.println(WiFi.waitForConnectResult());
       delay(100);
       return;
     }
   }
 
   if (!client.connected()) {
-    Serial.println("PubSub not connected");
     String clientId = String(IR_TOPIC) + String("IR_Receiver");
     if (client.connect(clientId.c_str())) {
-      Serial.println("PubSub connected");
-      //client.subscribe(LED_TOPIC);
     } else {
-      Serial.println("PubSub failed to connect");
     }
   }
 

  long lastInterruptTime = globalLastInterruptTime;
  long duration = micros() - globalLastInterruptTime;
  if ((duration > END_TIME_VALUE)&&(globalCurrentEntry != 0)) {
    unsigned int currentEntries[MAX_CODE_ENTRIES];
    int numberEntries = 0;
    bool emitMessage = false;
    noInterrupts();

      numberEntries = globalCurrentEntry;
      memcpy(currentEntries, globalEntries, sizeof(int)*globalCurrentEntry);
      globalCurrentEntry = 0;
      emitMessage = true;
     }
    interrupts();
    
    if (emitMessage) {
      // eliminate short pulses as they are just noise
      int j = 0;
      for (int i = 0; i < numberEntries; i++) {
        if ((currentEntries[i] > MIN_PULSE_LENGTH) || (j == 0 ) || ((i + 1) >= numberEntries)) {
          currentEntries[j] = currentEntries[i];
          j++;
        } else {
          currentEntries[j-1] = currentEntries[j-1] + currentEntries[i] + currentEntries[i+1];
          i++;
        }
      }
      numberEntries = j;

      if (numberEntries < MIN_MESSAGE_ENTRIES) {
        // anything shorter is not a real message
        return;
      }

      String message;
      for (int i = 0; i < numberEntries; i++) {
        char buffer[sizeof(int)*2 + 1];
        message = message + String(ultoa(currentEntries[i], buffer, 16));
        if (i != numberEntries -1) {
          message = message + String(",");
        }
