More efficient Frequency count