draft code for serial reading