Finished the calcFreq method