modularized the serial I/O out to be an independence part