Query refactored, finally