Move serialport handling code.