cleaned up pyserial code