     }
     serialOut("card initialized.");
 
-
+#if TEST
+    //print out all files on the card
+    TGC_logfile = SD.open("/");
+    printDirectory(TGC_logfile, 0);
+#endif
 
     // create a new file
     newFile();
-    // connect to RTC
-    Wire.begin();  
-    if (!RTC.begin()) {
-        TGC_logfile.println("RTC failed");
-    serialOut("RTC failed");
-    }
-#endif
 
 }//setup
 

        "Battery Amps, Solar Amps,Hydro Amps,Load Amps,Battery Energy State,"
        "Outside Temp,Cabin Temp,Battery Temp\n", year, month, day, hour, minute, second, unix);

    sprintf(filename, "%010lu_%04d-%02d-%02dT%02d%02d%02d.csv", unix, year, month, day, hour, minute, second);

    //readTime(temp);
    //strcat(temp, ".csv");
    //memcpy(filename, temp, sizeof(char)*NAME_LENGTH);
#if TEST
    return;
#endif
    
    /*
    TGC_logfile.close();

    if (! SD.exists(filename)) {


void newFile(){

    // Fat32 limits file names to 8 characters plus a 3 character extension
    // UNIX time is 10 characters long so we truncate off the first two characters to 
    // form the file name. 

    DateTime now = RTC.now();
    unsigned long unix   = now.unixtime();
    int year   = now.year();
    int month  = now.month();
    int day    = now.day();
    int hour   = now.hour();
    int minute = now.minute();
    int second = now.second();

    char buff[580];
    char *header = buff;
