adding a query function