 const int offset = 50; // 5
 
 // HVAC system parameters
-const int fanDelay = 6000; // ms
+const unsigned long fanDelay = 60000; // ms, 1 minute
+const unsigned long cycleOn = 900000; // ms, 15 minutes
+const unsigned long cycleOff = 2700000; // ms, 45 minutes
+
 
 // global variables used in the loops
 int centerpoint;
 uint8_t mode;
 
 void setup(void) {
-    // variable declaration
-    uint8_t check;
-
     // setup digital pins
     pinMode(buttonUp, INPUT); // is default
     pinMode(buttonDwn, INPUT); // is default

    yellow wire - cooling
    white wire - heating
    */
    static unsigned long timeFan = 0;
    unsigned long timeCurrent = millis();

    switch(unit) {
        case cool:
            if ((timeCurrent - timeFan) < fanDelay) {
                driveUnit(fan);
            } else {
                if (digitalRead(relayAC) != HIGH) {
                    digitalWrite(relayAC, HIGH);
                }
            }
            break;
        case heat:
            if ((timeCurrent - timeFan) < fanDelay) {
                driveUnit(fan);
            } else {
                if (digitalRead(relayHeat) != HIGH) {
                    digitalWrite(relayHeat, HIGH);
                }
            }
            break;
        case fan:
            if (digitalRead(relayFan) != HIGH) {
                timeFan = timeCurrent;
                digitalWrite(relayFan, HIGH);
            }
            break;
        case shutdown:

        default:
            digitalWrite(relayFan, LOW);
            digitalWrite(relayAC, LOW);
            digitalWrite(relayHeat, LOW);
            break;
    }
}


int getEEPROMint(int address) {
    uint8_t hiByte, loByte;

    hiByte = EEPROM.read(address);
    loByte = EEPROM.read(address + 1);

    return word(hiByte, loByte);
}


void setEEPROMint(int address, int value) {
    uint8_t hiByte, loByte;

    hiByte = highByte(value);
    loByte = lowByte(value);

    if (EEPROM.read(address) != hiByte) {
        EEPROM.write(address, hiByte);
    }
    if (EEPROM.read(address + 1) != loByte) {
        EEPROM.write(address + 1, loByte);
    }
}


void setEEPROMbyte(int address, uint8_t value) {
    if (EEPROM.read(address) != value) {
        EEPROM.write(address, value);
    }


    // if this is first time button is pressed, move the setpoint
    // if both buttons are pressed, toggle system on and off and save to eeprom
    // write this as an interrupt someday?
    if ((stateUp == LOW) && (stateDwn == LOW) && (prevUp != LOW) && (prevDwn != LOW)) {
        if (mode == off) {
            mode = on;
