Update query function to execute query instead of calling a function that doesn't exist