Handle serial input and output better.