Query dead-code cleanup