     if (key) {
       if (key == '#' || key == '*') {
         if (buffer == "0") {
-          Serial.print("LOCK;");
+          Serial.println("LOCK;");
           setState(LOCKED);
         }        
       } else {

long timeout_start = 0;
long timeout = 10000;

String buffer = "";

void updateDisplay() {
  lcd.clear();
  if (state == LOCKED) {
    /*
    Serial.println("+--------------------+");
    Serial.println("|                    |");
    Serial.println("| Hello Stranger!    |");
    Serial.println("|   Door is locked.  |");
    Serial.println("|                    |");
    Serial.println("+--------------------+");
    */
    lcd.print("Hello Stranger! ");
    lcd.setCursor(0, 1);
    lcd.print(" Door is locked.");
  } else if (state == PIN_ENTRY) {
    /*Serial.println("+--------------------+");
    Serial.println("|Entry token read.   |");
    Serial.println("|Please enter PIN:   |");
    Serial.print("| ");
    for (int i = 0; i < buffer.length(); i++) {
      Serial.print("*");
    }
    for (int i = 0; i < 18-buffer.length(); i++) {
      Serial.print(" ");
    }
    Serial.println(" |");
    Serial.println("|                    |");
    Serial.println("+--------------------+");
    */
    lcd.print("Please enter PIN");
    lcd.setCursor(0, 1);
    for (int i = 0; i < buffer.length(); i++) {
      lcd.print("*");
    }
  } else if (state == WAIT_FOR_UNLOCK) {
    /*Serial.println("+--------------------+");
    Serial.println("|                    |");
    Serial.println("| Waiting for        |");
    Serial.println("|       unlocking    |");
    Serial.println("|                    |");
    Serial.println("+--------------------+");*/
    lcd.print("Waiting for     ");
    lcd.setCursor(0, 1);
    lcd.print("   confirmation ");
  } else if (state == INVALID_PIN) {
    /*
    Serial.println("+--------------------+");
    Serial.println("|                    |");
    Serial.println("| Invalid PIN        |");
    Serial.println("|   Pleas try again. |");
    Serial.println("|                    |");
    Serial.println("+--------------------+");
    */
    lcd.print("Invalid PIN     ");
    lcd.setCursor(0, 1);
    lcd.print("Please try again");
  } else if (state == UNLOCKED) {
    /*
    Serial.println("+--------------------+");
    Serial.println("|     Welcome!       |");
    Serial.println("| The space is open. |");
    Serial.println("|                    |");
    Serial.println("| Press 0# to lock.  |");
    Serial.println("+--------------------+");
    */
    lcd.print("Space is open   ");
    lcd.setCursor(0, 1);
    lcd.print("Press 0# to lock");

    char key = keypad.getKey();
    if (key) {
      setState(PIN_ENTRY);
      buffer += key;
      updateDisplay();
    } else if (timeoutExpired()) {
      setState(LOCKED);
