implement frequency table generation