changed frequency calculation