Refactored freqDist.js.