   // print the string when a newline arrives:
   if (stringComplete) {
     digitalWrite(led, LOW); // Turn off the LED.  We are processing now
-    // Stuff
-    //Serial.print(inputString);
-    //Serial.println(inputCommand);
-    //Serial.println(inputValue);
+
+    if (val) {
+      simVar = inputValue; // Update the global sim variable
+    }
+
+    // Simple command validating.
+    if (com || (com && val))  { // Check if a command and value was received.
+      res = 0; // Set it to pass and invalidate with future tests.
+      if (inputCommand.length() > 8) { // Commands wont ever be greater than 8.
+        res = 3;
+      } else {
+        testString += inputCommand; // Test if its upper case or not
+        testString.toUpperCase();
+        if (testString != inputCommand){
+          res = 3;
+          // TODO test values
+        }
+      }
+    }
+
 
     switch (res) {
-      case 0:
-        // No Error
+      case 0:   // No Error
+        if (com && val) {
+          Serial.println("!0");
+        } else {
+          Serial.println("!0 " + simVar);
+        }
         break;
-      case 3:
-        // Format Error
+      case 3:   // Format Error
+        Serial.println("!3");
         break;
-      case 4:
-        // Argument Error
+      case 4:   // Argument Error
+
         break;
-      case 5:
-        // Command Execution Impossible
+      case 5:   // Command Execution Impossible
+
         // busy for other command execution
         break;
-      case 6:
-        // Command Execution Impossible
+      case 6:   // Command Execution Impossible
+
         // mismatch in interpretation of entered command
         break;
-      default:
-        // statements
-        Serial.print("!3 "+ inputString);
+      default:  // Unhandled
+
+        if (inputCommand.length() > 0) {
+          Serial.print("!3 "+ inputString);
+        } else {
+          Serial.print("!3");
+        }
     }
 
     // clear the string:
     inputString = "";
     inputCommand = "";
     inputValue = "";
+    testString = "";
     stringComplete = false;
     separator = false;
+    val = false;
+    com = false;
+    res = 1;
   }
 }
 

    <CR>: Carriage return code; a terminator signifying the end of a command
    _: Space code: used to separate between the command and argument or between arguments


 */

String inputCommand = ""; // A string to capture the command before the space
String inputValue = "";  // A string to capture command value after space
String inputString = ""; // The raw Readline string

boolean stringComplete = false;  // whether the string is complete
boolean separator = false; // When a space is received

int led = 13; // An indication LED Pin
int res; // Response status

void setup() {
  // initialize serial:

  inputString.reserve(200); // Who knows
  inputCommand.reserve(20);  // These need to be short
  inputValue.reserve(20); //TODO: Stop appending if to many chars a rerecived.
  simVar.reserve(20);
  digitalWrite(led, LOW);
}

