added serial reading in main