continued modularizing serial reading code