implemented populate_max_tags