working on global frequency count