Implementing query.