     pinMode(GREEN_LED, OUTPUT); 
     pinMode(YELLOW_LED, OUTPUT);
     digitalWrite(YELLOW_LED, HIGH);
-   digitalWrite(GREEN_LED, HIGH);
-  digitalWrite(RED_LED, HIGH); 
-  delay(2000);
-  
+    digitalWrite(GREEN_LED, HIGH);
+    digitalWrite(RED_LED, HIGH); 
+    delay(2000);
   #endif
   #ifdef USELCD
     ClearScreen();
     lcdSerial.write("Please scan card");
   #endif
+  Stop = true;
 }
 
 
 void loop()
 {
+  CountDownTimer(); // run the timer
+  if (TimeHasChanged()) 
+  { 
+    #ifdef DEBUG
+      Serial.print(ShowHours());
+      Serial.print(":");
+      Serial.print(ShowMinutes());
+      Serial.print(":");
+      Serial.print(ShowSeconds());
+      Serial.print(":");
+      Serial.print(ShowMilliSeconds());
+      Serial.print(":");
+      Serial.println(ShowMicroSeconds());
+    #endif
+    
+    // This DOES NOT format the time to 0:0x when seconds is less than 10.
+    // if you need to format the time to standard format, use the sprintf() function.
+    if(Stop == true)
+    {
+      #ifdef DEBUG
+        Serial.println("Stop reached");
+      #endif
+      #ifdef USELED
+     
+      #endif 
+       digitalWrite(RELAY1,HIGH);
+    }
+  }
+   
       int gotCard = 0;
       String serial;
       String pin ="";

	return accessResponse;
  #endif
}

  Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );
#endif

unsigned long Watch, _micro, time = micros();
unsigned int Clock = 0, R_clock;
boolean Reset = false, Stop = false, Paused = false;
volatile boolean timeFlag = false;
String storedSerial;

      
#ifdef USELCD
  // Attach the serial display's RX line to digital pin 2
  SoftwareSerial lcdSerial(3,2); 
