changed frequency calculation location