Cleaned up serial port code