function for max freq get