         WiServer.print(tmpStrCat);
       }
 
-        WiServer.print("</html> ");
+        WiServer.print("</body></html>");
         return true;
    }
    else {

void sendCodeOnce() {
  unsigned long time = millis();

  if ( (time - sentLockMillis) > 10000) { //10 seconds
    Serial.println("Sending once");
    sendCode();
    sentLockMillis = time;
  }
}

void loop()
{
  int buttonState = digitalRead(BUTTON_PIN);
  int lightValue = analogRead(ANALOG_LIGHT_PIN);
  
  if (lightValue < 200) {
    sendCodeOnce();
  }

  if (buttonState == HIGH) {
    if (irrecv.decode(&results)) {
      storeCode(&results);
      irrecv.resume(); // resume receiver

int codeLen; // The length of the code
int toggle = 0; // The RC5/6 toggle state
unsigned long sentLockMillis = 0;
unsigned long tempLockMillis = 0;

// Stores the code for later playback
// Most of this code is just logging
