added function that reads the serial buffer