 }
 
 char crnl[] = {'\r', '\n', '\r', '\n'};
+// Counts the amount of mathching bytes found in the stream.
+// It can not be local to checkBytes
+int matchingBytes = 0;
 
 bool checkBytes(char* bytes, char (*stream)()) {
-  int check = 0;
-  while(check < 4) {
-    check = bytes[check] == stream() ? check + 1 : 0;
+  int byteCount = 0;
+  while(matchingBytes < 4) {
+    matchingBytes = bytes[matchingBytes] == stream() ? matchingBytes + 1 : 0;
+    byteCount++;
+    if (byteCount >= 2048) {
+      return false;
+    }
     delay(1);
   }
-  return (check == 4);
+  return (matchingBytes == 4); // a bit pedantic
 }
 
 
 int twoBytes() {
   int tempVal = 0;
   byte one = client.read();
-  delayMicroseconds(400);
   byte two = client.read();
   tempVal = one << 8;
   tempVal |= two;

  //Serial.println(F("THIS PROGRAM HAS BEEN UPDATED!!!!"));
  // Leave this here
  apolloUpdate();
  // put your main code here, to run repeatedly:

  if (temp < updateCounter) {
    Serial.println(updateCounter * 8);


char byteStream() {
  //Serial.println("byteStream called");
  char a = client.read();
  Serial.print(a);
  return a;
