added the original script used to read from serial port