 		}
 		else if (request.startsWith("setoat"))
 		{
+			// TODO: don't allow OAT to be
+			// set if box is in a locked state
+			
 			setOpenAtTime(request.substring(request.indexOf(':') + 1));
 			if (DEBUG) printDebugInfo();
 		}
 	}
-
-	//delay(100);
 }
 
 void setOpenAtTime(String oat)
 {
 	openAtTime = oat.toFloat();
 
-	Serial.print("--------oat string: ");
-	Serial.println(oat);
-	Serial.print("--------oat float: ");
-	Serial.println(oat.toFloat());
-
 	EEPROMWritelong(OAT_ADDRESS, openAtTime);
 }
 
-String readBluetoothRequest()
-{
-	String request;
-	if (bluetoothSerial.available())
-	{
-		request = bluetoothSerial.readString();
-	}
-
-	return request;
-}
-
 String formatJsonString(String key, String value)
 {
 	return "{\"key\":\"" + key + "\",\"value\":\"" + value + "\"}";
 }
 
-//bool lockPosition() //true - locked, false - open
-//{
-//
-//}
-
 void lockControl(String position)
 {
 	if (position == "lock")
 	{
 		lockServo.write(LOCK_LOCKED);
-		lockServo.attach(LOCK_SERVO_PIN);
-		EEPROM.write(LOCK_POSITION, true);
+		lockPosition = locked;
 	}
 	else if (position == "open")
 	{
 		lockServo.write(LOCK_OPEN);
-		lockServo.attach(LOCK_SERVO_PIN);
-		EEPROM.write(LOCK_POSITION, false);
-	}
-
-	delay(500);
-	isLocked = (bool)EEPROM.read(LOCK_POSITION);
+		lockPosition = open;
+	}
+
+	lockServo.attach(LOCK_SERVO_PIN);
+	delay(1000);
 	lockServo.detach();
 }
 

	Serial.print("oat:\t\t");
	Serial.println(openAtTime);
	Serial.print("second remain:\t");
	Serial.println(openAtTime - getRtcTime());
	Serial.print("lock position:\t");
	Serial.println(isLocked ? "locked" : "open");
	Serial.println("---------------------");
}


{
	if (openAtTime <= getRtcTime()) // should be open
	{
		if (lockPosition == locked || lockPosition == unknown)
		{
			lockControl("open");
			if (DEBUG)
