optimized query a bit