added getfreq(), getfreq.c