     auto& h = *output;
     h.data_mask = data_mask;
 
+    std::vector<std::string> gamgee_chromosomes(0);
+
     for(auto& record : gamgee::VariantReader<gamgee::VariantIterator>{std::string(filename)})
     {
         // collect all the common variant data


        // for each possible alternate, add one entry to the variant database
        // xxxnsubtil: this is wrong if alternate data is masked out in data_mask!
        for(std::string& alt : record.alt())
        {
            h.num_variants++;


            uint32 n_alleles;
        } variant_data;

        // header.chromosomes() and record.chromosome_name() are *very* slow
        // unfortunately, gamgee does not really expose a better way of implementing this
        auto gamgee_chromosome_id = record.chromosome();
        if (gamgee_chromosome_id >= gamgee_chromosomes.size())
        {
            // reload the list of chromosomes from gamgee
            gamgee_chromosomes = record.header().chromosomes();
        }

        const std::string& chromosome_name = gamgee_chromosomes[gamgee_chromosome_id];
        reference_handle->make_sequence_available(chromosome_name);

        if (data_mask & VariantDataMask::CHROMOSOME)
