query 4 working. Only q2 left. And optimizations