Making ranked_species a function