Improving the queries