VCF export query/loop restructured