                     Modem_CommandBuffer[strlen(Modem_CommandBuffer) - 1] = '\0';
                 }
             }
-            else if (inbound != '\r' && inbound != '\n' && inbound != Modem_S2_EscapeCharacter)
+            else if (inbound != '\r' && inbound != '\n' && inbound != Modem_S2_EscapeCharacter && isValid)
             {
                 if (strlen(Modem_CommandBuffer) >= COMMAND_BUFFER_SIZE) {
                   //Display (F("CMD Buf Overflow"));

    pinMode (C64_RxD, INPUT);
    digitalWrite (C64_RxD, HIGH);

    Display(F("Baud\ndetection"));

    long detectedBaudRate = detRate(C64_RxD);  // Function finds a standard baudrate of either
    // 1200,2400,4800,9600,14400,19200,28800,38400,57600,115200

    }

    Modem_Connected();
}

// Main processing loop for the virtual modem.  Needs refactoring!
