Implemented popularity queries.