Changes to query + fixed checkbox