     // if it's there, load the previous settings
     // otherwise use the defaults and write them to EEPROM
     // note that mode only stores either "on" or "off"
-    check = EEPROM.read(eepCheckAddr);
-    if (check == eepCheckVal) {
+    if (eepCheckVal == EEPROM.read(eepCheckAddr)) {
         Serial.println(F("Using mode and temperature from EEPROM"));
         mode = EEPROM.read(eepModeAddr);
         centerpoint = getEEPROMint(eepCenterpointAddr);

    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;
