Query 1 Optimized for running time