max_genome function