Cleanup and implement circular buffer based UART communication