                                             string_3, string_4, string_5
                                            };
 
-#if DEBUG
-const char debug_0[] PROGMEM = "Searching for GPS";
-const char debug_1[] PROGMEM = "GPS Found!";
-const char debug_2[] PROGMEM = "Asking for wifi";
-const char debug_3[] PROGMEM = "Waiting WiFi";
-const char debug_4[] PROGMEM = "Sending Data";
-const char debug_5[] PROGMEM = "WiFi available";
-const char debug_6[] PROGMEM = "File Restarted!";
-const char debug_7[] PROGMEM = "DHT failure";
-const char debug_8[] PROGMEM = "WiFi not available";
-const char debug_9[] PROGMEM = "Data sent";
-
-const char* const debug_table[] PROGMEM = {debug_0, debug_1, debug_2,
-                                           debug_3, debug_4, debug_5,
-                                           debug_6, debug_7, debug_8,
-                                           debug_9
-                                          };
-#endif
-
 char buffer[40];
-
-//DateTime is in DDMMYYHHMMSSCC format
-TinyGPSPlus gps;
-DHT dht(DHTPIN, DHTTYPE);
-
-int iteration = 0;
-
-SoftwareSerial gpsSerial(GPS_RX, GPS_TX);
 SoftwareSerial wifiSerial(WIFI_RX, WIFI_TX);
 String filename("log.txt");
+unsigned long filesize;
 
 void start_file() {
-  //strcpy_P(buffer, (char*)pgm_read_word(&(string_table[0])));
   if (SD.begin(SD_CHIP_SELECT)) {
     SD.remove(filename);
-    //strcpy_P(buffer, (char*)pgm_read_word(&(string_table[0])));
     File data_file = SD.open(filename, FILE_WRITE);
+    
     for (int i = 0; i < 200; i ++) {
       data_file.print(String(i) + ",aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n");
     }
     data_file.close();
+    data_file = SD.open(filename, FILE_WRITE);
+    filesize = data_file.size();
+    Serial.println("File size = " + String(filesize) + "bytes");
   }
 }
-
-#if DEBUG
-void print_debug(int i) {
-  strcpy_P(buffer, (char*)pgm_read_word(&(debug_table[i])));
-  Serial.println(buffer);
-}
-#endif
-
 
 
 void start_message() {

    }
    wifiSerial.write(end_of_file);
    delay(500);
    Serial.println(__LINE__);
  }
  data_file.close();

  //Remove the file and create a new
  //start_file();

#if DEBUG
  print_debug(9);
#endif
}

bool start_connection() {
  // Check for connection
  wifiSerial.listen();
  while (!wifiSerial.isListening()) {
    Serial.println(__LINE__);
  }
  wifiSerial.print(request);
  int index = 0;
  while (!wifiSerial.available()) {

  
  while (data_file.available()) {
    if(!start_connection()){
      break;
    }
    String a;
    int i = 0;  
    start_message();
    while (data_file.available() and i < BATCH_SIZE) {      
      i++;
      a = data_file.readStringUntil('\n');
      wifiSerial.print(a + "\n");
