Add helper function for frequency