working code, handles uart simply