UART framework and some cleanup