               
                if(accessResponse.TimeLimit != 0)
                {
+                 
                  #ifdef DEBUG
                    Serial.println(accessResponse.TimeLimit);
                  #endif
                  //Need to add a countdown timer here so that time counts down the time remaining and outputs to the LCD
-                 delay(accessResponse.TimeLimit * 60000);
-                 digitalWrite(RELAY1,HIGH); //Turn off time limit expires.  Need to add the current check and other logic here.  Very basic rightnow.  Delay is not 
+                 //delay(accessResponse.TimeLimit * 60000);
+                 CountDownTimer(); // run the timer
+                 SetTimer(0,0,accessResponse.TimeLimit * 60); // 10 seconds
+                 StartTimer();
                }
                
            }
            else{
                #ifdef USELED
-                  digitalWrite(RED_LED, HIGH);
+                  TurnOnLED(RED_LED);
                #endif
                #ifdef USETONE
                   tone(TONEPIN,100,1000);

    pinMode(GREEN_LED, OUTPUT); 
    pinMode(YELLOW_LED, OUTPUT);
    digitalWrite(YELLOW_LED, HIGH);
   digitalWrite(GREEN_LED, HIGH);
  digitalWrite(RED_LED, HIGH); 
  delay(2000);
  
  #endif
  #ifdef USELCD
    ClearScreen();
    lcdSerial.write("Please scan card");
  #endif
}


void loop()
{
      int gotCard = 0;
      String serial;
      String pin ="";

               #endif
           }
           delay(2000);
          }
        }
      }
      #ifdef USELED
          TurnOnLED(YELLOW_LED);
      #endif
      #ifdef USELCD         
           ClearScreen();
           lcdSerial.write("Please scan card");
      #endif
}

void TurnOnLED(int LED)
{
  TurnOffAllLED();
  digitalWrite(LED,HIGH);
  
}
void TurnOffAllLED()
{
    digitalWrite(RED_LED, LOW);
    digitalWrite(GREEN_LED, LOW);
    digitalWrite(YELLOW_LED, LOW);
}

void ClearScreen()
