Improve a query