query improvements