 void loadConfiguration() {
     // Ensure the version string matches our version string; if it doesn't, we
     // should just use the default configuration
-    if (EEPROM.readByte(config_address + sizeof(config) - 1) == *config.version[3]
-        && EEPROM.readByte(config_address + sizeof(config) - 2) == *config.version[2]
-        && EEPROM.readByte(config_address + sizeof(config) - 3) == *config.version[1]
-        && EEPROM.readByte(config_address + sizeof(config) - 4) == *config.version[0]) {
-        Serial.println("Configuration matched!");
-        EEPROM.readBlock(config_address, config);
+    char stored_version[4];
+    EEPROM.readBlock(config_address, stored_version);
+
+    if (strcmp(stored_version, config.version) == 0) {
+        int bytes_read = EEPROM.readBlock(config_address, config);
+
+        Serial.print("Loaded configuration; version: ");
+        Serial.print(stored_version);
+        Serial.print("; bytes read: ");
+        Serial.println(bytes_read);
     } else {
-        Serial.println("Configuration did not match!");
+        Serial.print("Not loading old configuration; version: ");
+        Serial.println(stored_version);
     }
 }
 

#include <avr/sleep.h>
#include <EEPROMex.h>

/**
 * Configuration version, used for validating configuration integrity.
 * @type char*
 */
const char* CONFIG_VERSION = "1";

/**
 * Size of the configuration block memory pool.
 * @type int
 */
const int CONFIG_MEMORY_SIZE = 32;

/**
 * EEPROM size. Bad things will happen if this isn't set correctly.
 * @type int
 */
const int CONFIG_EEPROM_SIZE = EEPROMSizeATmega328;

/**
 * Configuration memory address, used to determine where to read and write
 * data.
 * @type int
 */
int config_address = 0;

/**
 * Configuration structure. Also contains the default configuration.
 */
struct ConfigurationStruct {
    /**
     * Delay between loops, in milliseconds.
     * @type int
     */
    int loop_delay;

    /**
     * Serial input buffer size, in bytes.
     * @type int
     */
    int serial_input_buffer_size;

    /**
     * Boolean indicating whether debug mode is enabled.
     * @type bool
     */
    bool debug;

    /**
     * Character string indicating configuration version.
     * @type char[4]
     */
    char* version[4];
} config = {
    50,
    32,
    false,
    (char*) CONFIG_VERSION
};

/**
 * Serial input structure.
 */
struct SerialInputStruct {
    /**
     * Boolean indicating whether the input buffer is ready for processing.
     * @type bool
     */
    bool ready;

    /**
     * Input buffer containing received serial data.
     * @type String|char*
     */
    String buffer;
} serial_input = {
    false,
    ""
};

/**
 * Power button pin number.
 * @type int
 */
const int POWER_BTN = 2;

/**
 * Power LED pin number.
 * @type int
 */
const int POWER_LED = 13;

/**
 * Byte containing states/state history of the power button.
 * @type byte
 */
byte POWER_BTN_STATES = B11111111;

/**
 * Enum containing power states.
 * @type enum
 */
enum PowerState {
    SLEEPING,
    AWAKE
};

/**
 * Boolean indicating current power state.
 * 0 = sleeping / powered down
 * 1 = awake / fully powered
 * @type int
 */
int POWER_STATE = AWAKE;

/**

 */
void saveConfiguration() {
    Serial.println("Saving configuration");

    int bytes_written = EEPROM.updateBlock(config_address, config);

    Serial.print("Configuration saved; version: ");
    Serial.print(config.version);
    Serial.print("; bytes written: ");
    Serial.println(bytes_written);
}

/**
