 
 char auth[] = "fromBlynkApp";
 char ssid[] = "ssid";
-char pass[] = "pw";
-
-char myEmail[] = "email";
-
-char* hostSF = "192.168.0.168";
-char* streamId   = "publicKey";
-char* privateKey = "privateKey";
+char pass[] = "ssid";
 
 SimpleTimer timer;
-
 WidgetRTC rtc;
 WidgetTerminal terminal(V26);
 
-const int blowerPin = 13;  // WeMos pin D7.
-const int fanPin = 14;     // Future fan only pin.
-bool daySet = FALSE;       // Sets the day once after reset and RTC is set correctly.
-
-bool runOnce = TRUE;
-bool resetFlag = TRUE;        // TRUE when the hardware has been reset.
-bool startFlag = FALSE;       // TRUE when the A/C has started.
-bool stopFlag = FALSE;        // TRUE when the A/C has stopped.
-bool sensorFailFlag = FALSE;  // TRUE when RA or SA temp sensor are returning bad values.
-
-int offHour, offHour24,  // All used to send an HVAC run status string to Blynk's app.
-    onHour, onHour24, offMinute, onMinute, offMonth, onMonth, offDay, onDay;
-
-int tempSplit;                    // Difference between return and supply air.
-const int tempSplitSetpoint = 20; // Split lower than this value will send alarm notification.
-int alarmFor = 0;                 // Provides "latching" for high split alarm counting & functionality. 0 is normal. 1 is prealarm. 5 is alarmed and lockout.
-const int splitAlarmTime = 180;   // If a high split persists for this duration (in seconds), notification is sent.
-int alarmTime;                    // Seconds that high split alarm has been active.
-
-long todaysAccumRuntimeSec;           // Today's accumulated runtime in seconds - displayed in app as minutes.
-int currentCycleSec, currentCycleMin; // If HVAC is running, the duration of the current cycle (non-accumulating).
-int yesterdayRuntime;                 // Sum of yesterday's runtime in minutes - displays in app.
-int hvacTodaysStartCount;             // Records how many times the unit has started today.
-int todaysDate;                       // Sets today's date related to things that reset at EOD.
-String currentTimeDate;               // Time formatted as "0:00AM on 0/0"
-String startTimeDate, stopTimeDate, resetTimeDate;
-int runStatus;                        // Used for graphing. 40 == running. NULL == off.
-String currentStatus;                 // What displays in app. Used solely for sync and recover purposes.
-
-long currentFilterSec;                // Filter age based on unit runtime in seconds (stored in vPin). Seconds used for finer resolution.
-long currentFilterHours;              // Filter age based on unit runtime in hours.
-long timeFilterChanged;               // Unix time that filter was last changed.
-bool filterConfirmFlag = FALSE;       // Used to enter/exit the filter change mode.
-const int filterChangeHours = 300L;   // Duration in hours between filter changes. Up for debate and experimentation!
-bool changeFilterAlarm = FALSE;       // TRUE if filter needs to be changed, until reset.
-
-long todaysAccumRuntimeSecCooling;    // Seconds that system has been cooling.
-long todaysAccumRuntimeSecHeating;    // Seconds that system has been heating.
-bool heatingMode;                     // FALSE = Cooling. TRUE = Heating.
-bool hvacMode;                        // FALSE = Cooling. TRUE = Heating.
-
-double tempRA, tempSA;                // Return and supply air temperatures
-
-// HVAC control pins
-int coolingRelay = 5;   // WeMos pin D1.
-int heatingRelay = 4;   // WeMos pin D2.
-int fanRelay = 16;      // WeMos pin D0.
-int bypassRelay = 0;    // WeMos pin D3.
-
-int controlSplit = 2;   // Predefined value of how much I want to heat or cool above/below setpoint.
-int controllingTemp;
-int setpointTemp;
-String controllingSpace;
-bool coolingMode;       // 1 = cooling. 0 = heating.
-bool controlMode;
-int tempKK, tempLK, tempAT;
-
-long controlStart;
-long controlRuntime;
-long heatControlTimeout = 600000; // 600000 millis = 10 minutes
-long coolControlTimeout = 120000000; // 120000000 millis = 20 minutes
-bool controlLatch = FALSE;
-
-bool blynkFlag;
-int blynkDisconnectCount;
+const int fanRelay = 16;      // WeMos pin D0. Set LOW to start fan-only.
+const int coolingRelay = 5;   // WeMos pin D1. Set LOW to start cooling.
+const int heatingRelay = 4;   // WeMos pin D2. Set LOW to start heating.
+const int bypassRelay = 0;    // WeMos pin D3. Set LOW to bypass house t-stat.
+const int fanPin = 14;        // WeMos pin D5. LOW when fan-only is running.
+const int blowerPin = 13;     // WeMos pin D7. LOW when cool or heat is running.
+
+double tempRA, tempSA;        // Return air and supply air temperatures.
+
+bool fanOnly;         // true when fan-only mode is running
+bool fanCooling;      // true when cooling mode is running
+bool fanHeating;      // true when heating mode is running
+
+long todaysRuntimeSec;  // How many seconds the HVAC ran today
+int todaysRuntimeMin;   // How many minutes the HVAC ran today
+int currentRunSec;      // How many seconds the HVAC has ran in it's current cycle (resets after HVAC turns off)
+long filterUseSec;      // How many seconds the current filter has been used. Can be reset manually after filter change.
+int yesterdaysRuntimeSec, yesterdaysRuntimeMin;
+int todaysRuns;         // How many times the HVAC has ran today (counted when it shuts off).
+int coolingCounter, heatingCounter;   // Count approx how many minutes unit cooled/heated. Used for Tweeting.
+String currentStatus;   // For the sole purpose of syncing back the status label after a hardware reset
+int todaysDate;         // Today's date (15 or 16, etc)
+
+String currentTime;
+String currentTimeDate;
+String changeTimeDate;
+bool changeFlag;
+
 bool ranOnce;
+bool filterChangeMode;
+bool startupSynced;
+
+int fanStatusTimer, setClockTimeTimer, tempDisplayTimer, statusDisplayTimer, longStatusDisplayTimer, tempWatcherTimer;
+
+double tempAT, tempKK, tempLK, tempMK;  // Temperatures bridged in from other devices to use for control.
+int controllingRoom;
+int setpointTemp;     // The HVAC target temperature
+int triggerTemp = 1;  // The number of degrees above/below setpoint that the HVAC will start
+int tempDiff = 1;     // Temperature differential. You can add 1 to whatever is here because of the way the code compared a double and an int.
+bool coolingMode, heatingMode;  // True when cooling or heating is on
+int i, maxT, highRoom;    // Used to evaluate all room temperatures in whole-house cooling mode
 
 void setup()
 {
   Serial.begin(9600);
   WiFi.mode(WIFI_STA);
 
-  //WiFi.softAPdisconnect(true); // Per https://github.com/esp8266/Arduino/issues/676 this turns off AP
   Blynk.begin(auth, ssid, pass);
 
   sensors.begin();
   sensors.setResolution(ds18b20RA, 10);
   sensors.setResolution(ds18b20SA, 10);
 
-  while (Blynk.connect() == false) {
-    // Wait until connected
-  }
-
+  // Set pin modes used to control HVAC
   pinMode(coolingRelay, OUTPUT);
   pinMode(heatingRelay, OUTPUT);
   pinMode(fanRelay, OUTPUT);

  digitalWrite(fanRelay, HIGH);
  digitalWrite(bypassRelay, HIGH);

  // START OTA ROUTINE
  ArduinoOTA.setHostname("hvacMonitor");     // Name that is displayed in the Arduino IDE.

  ArduinoOTA.onStart([]() {
    Serial.println("Start");

  // END OTA ROUTINE

  rtc.begin();

  fanStatusTimer = timer.setInterval(1000, fanStatus);
  setClockTimeTimer = timer.setInterval(1000, setClockTime);
  tempDisplayTimer = timer.setInterval(3210, tempDisplay);
  statusDisplayTimer = timer.setInterval(3543, statusDisplay);
  tempWatcherTimer = timer.setInterval(5000, tempWatcher);
  longStatusDisplayTimer = timer.setInterval(600000, longStatusDisplay);  // 10 minutes
  timer.setInterval(65432, updateVpinData1);

  timer.disable(fanStatusTimer);
  timer.disable(tempDisplayTimer);
  timer.disable(statusDisplayTimer);
  timer.disable(tempWatcherTimer);
}

void loop()  // To keep Blynk happy, keep most tasks out of the loop.
