enhancements to the frequency function
Merge origin/master