     SPI.setDataMode(SPI_MODE3);
     /* resync the ADC */
     resync_adc();
-    /* check if ADC device ID is valid */
-    bool valid_id = is_valid_adc_id();
+
+    byte id[2];
+     /* read the ADC device ID */
+    read_adc_register(ID_REG, id, 2);
+    /* check if the id matches 0x30DX, where X is don't care */
+    bool valid_id = id[0] == 0x30 && id[1] == 0xD0;
+    
+    /* when debug enabled */
     if (DEBUG_ENABLED) {
         if (valid_id) {
             Serial.println("ADC device ID is valid :)");
         } else {
             Serial.println("ADC device ID is invalid :(");
+            Serial.write(id[0]);
+            Serial.write(id[1]);
+            Serial.println();
         }
     }
     /* return if ADC id was valid */
     return valid_id;
-}
-
-/*
-=========================================
-configures the ADC chip
-@param byte - the register where to write
-@param  byte[] - the bytes to write
-@param int - the length of bytes to write
-=========================================
-*/
-int write_adc_register(byte reg, byte value[], int write_len) {
-    /* when specified register is invalid */
-    if (reg < 0x00 || reg > 0xFF) {
-        if (DEBUG_ENABLED) {
-            Serial.println("register out of range");
-        }
-        return 1;
-    }
-    /* send communication register id 0x00 */
-    SPI.transfer(0x00);
-    /* send write command to the specified register 0x00 - 0xFF */
-    SPI.transfer(0x00 | reg);
-    /* write the specified amount of bytes */
-    for (int i = 0; i < write_len; i++) {
-        SPI.transfer(value[i]);
-    }
-    /* when debug enabled
-    /* return if ADC id was valid */
-    if (DEBUG_ENABLED) {
-        Serial.print("wrote to ADC register: ");
-        for (int i = 0; i < write_len; i++) {
-            Serial.write(value[i]);
-        }
-        Serial.println();
-    }
-    /* return error code */
-    return 0;
-}
-
-/*
-=============================================
-reads the ADC channels
-@param byte - the register to read
-@param int - the length of bytes to read
-@return byte[] - the adc register read result
-=============================================
-*/
-int read_adc_register(byte reg, byte value[], int read_len) {
-    /* when specified register is invalid */
-    if (reg < 0x00 || reg > 0xFF) {
-        if (DEBUG_ENABLED) {
-            Serial.println("register out of range");
-        }
-        return 1;
-    }
-    /* send communication register id 0x00 */
-    SPI.transfer(0x00);
-    /* send read command to the specified register 0x00 - 0xFF */
-    SPI.transfer(0x40 | reg);
-    /* read the specified amount of bytes */
-    for (int i = 0; i < read_len; i++) {
-        value[i] = SPI.transfer(0x00);
-    }
-    /* when debug enabled */
-    if (DEBUG_ENABLED) {
-        Serial.print("received ADC register result: ");
-        for (int i = 0; i < read_len; i++) {
-            Serial.write(value[i]);
-        }
-        Serial.println();
-    }
-    /* return error code */
-    return 0;
-}
-
-/*
-==========================================
-reads the ADC conversion result
-@return byte[] - the ADC conversion result
-==========================================
-*/
-int read_adc_data(byte value[]) {
-    /* send communication register id 0x00 */
-    SPI.transfer(0x00);
-    /* send read command to the data register 0x04 */
-    SPI.transfer(0x4 | DATA_REG);
-    /* read the received value 24 bits */
-    value[0] = SPI.transfer(0x00);
-    value[1] = SPI.transfer(0x00);
-    value[2] = SPI.transfer(0x00);
-    /* when debug enabled */
-    if (DEBUG_ENABLED) {
-        Serial.print("received ADC conversion result: ");
-        Serial.write(value[0]);
-        Serial.write(value[1]);
-        Serial.write(value[2]);
-        Serial.println();
-    }
-    /* return error code */
-    return 0;
 }
 
 void setup() {

        read_adc_data(value);
        /* when ADC is out of sync */
        if (value == 0) {
            resync_adc();
        }
        delay(100);
    }

}

/*
=========================================
configures the ADC chip
@param byte - the register where to write
@param  byte[] - the bytes to write
@param int - the length of bytes to write
=========================================
*/
int write_adc_register(byte reg, byte *value, int write_len) {
    /* when specified register is invalid */
    if (reg < 0x00 || reg > 0xFF) {
        if (DEBUG_ENABLED) {
            Serial.println("register out of range");
        }
        return 1;
    }
    /* send communication register id 0x00 */
    SPI.transfer(0x00);
    /* send write command to the specified register 0x00 - 0xFF */
    SPI.transfer(0x00 | reg);
    /* write the specified amount of bytes */
    for (int i = 0; i < write_len; i++) {
        SPI.transfer(value[i]);
    }
    /* when debug enabled
    /* return if ADC id was valid */
    if (DEBUG_ENABLED) {
        Serial.println("wrote to ADC register: ");
        for (int i = 0; i < write_len; i++) {
            Serial.write(value[i]);
        }
        Serial.println();
    }
    /* return error code */
    return 0;
}

/*
=============================================
reads the ADC channels
@param byte - the register to read
@param int - the length of bytes to read
@return byte[] - the adc register read result
=============================================
*/
int read_adc_register(byte reg, byte *value, int read_len) {
    /* when specified register is invalid */
    if (reg < 0x00 || reg > 0xFF) {
        if (DEBUG_ENABLED) {
            Serial.println("register out of range");
        }
        return 1;
    }
    /* send communication register id 0x00 */
    SPI.transfer(0x00);
    /* send read command to the specified register 0x00 - 0xFF */
    SPI.transfer(0x40 | reg);
    /* read the specified amount of bytes */
    for (int i = 0; i < read_len; i++) {
        value[i] = SPI.transfer(0x00);
    }
    /* when debug enabled */
    if (DEBUG_ENABLED) {
        Serial.println("received ADC register result: ");
        for (int i = 0; i < read_len; i++) {
            Serial.write(value[i]);
        }
        Serial.println();
    }
    /* return error code */
    return 0;
}

/*
==========================================
reads the ADC conversion result
@return byte[] - the ADC conversion result
==========================================
*/
int read_adc_data(byte *value) {
    /* send communication register id 0x00 */
    SPI.transfer(0x00);
    /* send read command to the data register 0x04 */
    SPI.transfer(0x40 | DATA_REG);
    /* read the received value 24 bits */
    value[0] = SPI.transfer(0x00);
    value[1] = SPI.transfer(0x00);
    value[2] = SPI.transfer(0x00);
    /* when debug enabled */
    if (DEBUG_ENABLED) {
        Serial.println("received ADC conversion result: ");
        Serial.write(value[0]);
        Serial.write(value[1]);
        Serial.write(value[2]);
        Serial.println();
    }
    /* return error code */
    return 0;
}

/*
