moved serial functions into separate module