Added findfrequency() function