Query logic altered