added utility functions and tests for determining frequency