Added Query Optimization