Frequency table refactoring