add frequency calculation