Adding in a function to retrieve the raw query to act on