updates to query to include where