refactor uart class