refactored code revisions from Surya M.
refactoring
refactoring
the sketch moving to fast, reading from the serial port too often