findFrequency now works better