Video 31 completed - Implementing the query function