@Override
        public void serialEvent(SerialPortEvent event) {
            if (!event.isRXCHAR()) {//Ensure data is avaiable
                return;
            }
            if (event.getEventValue() <= 0) {//Ensure there is data to read 
                return;
            }
            //Get the data from the serial port
            byte buffer[];
            try {
                buffer = serialPort.readBytes(event.getEventValue());
            } catch (SerialPortException ex) {
                System.err.println(ex);
                buffer = new byte[0];
            }
            //Buffer the data in rawSensorData
            for (byte b : buffer) {
                rawSensorData.add(b);
            }
            //Look for valid streams
            while (rawSensorData.size() >= sensorDataLength) {
                if (rawSensorData.get(0) != (byte) SENSOR_STREAM_HEADER) {//Quickly serch for a possible header, dumping anything ahead of it
                    rawSensorData.remove(0);
                } else if (checkRawSensorData()) {//A valid stream at the start of the buffer
//                    System.out.println("Found a good one!");
                    interpretRawSensorData();
                    sensorDataIsValid.set(true);
                    watchdog.set(true);
                    if (sensorPacketListenerAdded) {
                        sensorPacketListener.sensorPacketReceived();
                    }
                } else {//It was not a header after all
                    rawSensorData.remove(0);
                }
            }
        }