refactored string formatting and serial port output out of the libraries