Implemented frequency query.