split serial writing into higher level functions
strip newline