finished video 31: Implementing the query Function