QueryOptimizer now clones the query so that optimizations keep the original in tact