rework serial connection, small changes