Updated serial port output to handle endlines