a semi-stable first version working with both serial and UDP