   pinMode(yellowLed, OUTPUT);
 
   //Initialize serial and wait for port to open:
-  Serial.begin(9600);
   flash_3leds(redLed, greenLed, yellowLed, 5, 100);
-  while (!Serial) { ; } // wait for serial port to connect.
   flash_3leds(redLed, greenLed, yellowLed, 5, 400);
 
   // check for the presence of the shield:
   if (WiFi.status() == WL_NO_SHIELD) {
-    Serial.println("WiFi shield not present");
     while (true); // stop
   }
 
   String fv = WiFi.firmwareVersion();
-  if ( fv != "1.1.0" )
-    Serial.println("Please upgrade the firmware");
-  Serial.print("Wifi firmware: ");
-  Serial.println(fv);
 
   // attempt to connect to Wifi network:
   while (status != WL_CONNECTED) {
-    Serial.print("Attempting to connect to SSID: ");
-    Serial.println(ssid);
     status = WiFi.begin(ssid, pass);
 
     delay(1000);
   }
-  Serial.println("Connected to wifi");
-  printWifiStatus();
-
-  Serial.println("Connecting to time server.");
   Udp.begin(localPort);
 
-  Serial.println("Getting time.");
   sendNTPpacket(timeServer); // send an NTP packet to a time server
   delay(500);
-  if(  Udp.parsePacket() ) get_and_print_time();
+  if( Udp.parsePacket() ) get_and_set_time();
+
+  open_file();
 }
 
 void loop() {
   // if there are incoming bytes available
   // from the server, read them and print them:
   while (client.available()) {
-    Serial.println("Client avaliable.");
-    Serial.println("Disconnecting...");
     lastConnectionTime=millis();
     client.stop();
   }

#include <stdio.h>
#include <SPI.h>
#include <WiFi.h>
#include <SPI.h>
#include <WiFiUdp.h>
#include <Time.h>


// private info [made generic here]
char ssid[] = "SSID";

    digitalWrite(greenLed, LOW);
    digitalWrite(redLed, HIGH);
  }
  if(canConnect != canConnect_prev) {
    time_to_string(now(), time_as_string);
    logfile.print(time_as_string);
    logfile.print(" - ");
    if(canConnect) logfile.println("connected.");
    else logfile.println("NOT CONNECTED!");
    logfile.flush();

    canConnect_prev = canConnect;
  }
}

void connect_to_server(void) {
  if (client.connect(server, 80)) {
    canConnect = true;
    client.println("GET /search?q=arduino HTTP/1.1");
    client.println("Host: www.google.com");
    client.println("Connection: close");
