   Udp.endPacket();
 }
 
-time_t getNTPTime() {
-  while (Udp.parsePacket() > 0) ; // discard any previously received packets
+time_t getNTPTime()
+{
+  while (Udp.parsePacket() > 0)
+    ; // discard any previously received packets
   Serial.println("Sending NTP Request");
   sendNTPpacket(timeServer);
   uint32_t beginWait = millis();
-  while (millis() - beginWait < 1500) {
+  while (millis() - beginWait < 1500)
+  {
     int size = Udp.parsePacket();
-    if (size >= NTP_PACKET_SIZE) {
+    if (size >= NTP_PACKET_SIZE)
+    {
       //We got a response
-      Udp.read(packetBuffer, NTP_PACKET_SIZE);  // read packet into the buffer
+      Udp.read(packetBuffer, NTP_PACKET_SIZE); // read packet into the buffer
       unsigned long secsSince1900, adjustedTime;
       // convert four bytes starting at location 40 to a long integer
-      secsSince1900 =  (unsigned long)packetBuffer[40] << 24;
+      secsSince1900 = (unsigned long)packetBuffer[40] << 24;
       secsSince1900 |= (unsigned long)packetBuffer[41] << 16;
       secsSince1900 |= (unsigned long)packetBuffer[42] << 8;
       secsSince1900 |= (unsigned long)packetBuffer[43];


  //Wait approximately for interLoopDelay miliseconds before doing it all again
  delay(INTERLOOPDELAY);

}

int getTime24() {
  // Return the current time as an integer value in 24 hour format
  DateTime theTime = rtc.now();
  return (theTime.hour() * 100) + theTime.minute();
}

bool isValidTime(int timeVal) {
  //Make sure the time value is between 0 and 2359 with
  // no minute value greater than 59
  return ((timeVal > -1) && (timeVal < 2360) && (timeVal % 100 < 60));
}


bool isInOnPeriod() {
  //Loop through the active slots array to see if the relay is
  //supposed to be on. This assumes the device just powered on
  //and it doesn't know whether it's supposed to be on or not.
  int timeVal = getTime24();
  for (int i = 0; i < NUMSLOTS; i++) {
    if ((timeVal > slots[i][0] ) && (timeVal < slots[i][1])) {
      //yep, we're supposed to be on
      return true;
    }

  // Connect to the network
  //==================================================
  // attempt to connect to the Wi-Fi network:
  while (status != WL_CONNECTED)
  {
    Serial.print("Connecting to ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
