modified for modem2.c