Query rework