Changed trending query code