my @top5 = grep { defined and $_->{'l'} and $_->{'c'} }
(sort { $b->{rank} <=> $a->{rank} } values %$color)[0..5];
if ((scalar uniq map {$_->{rank}} @top5) == 1) {
my @top5 = grep { defined and $_->{'l'} and $_->{'c'} }
(sort { $b->{rank} <=> $a->{rank} } values %$color)[0..5];
if ((scalar uniq map {$_->{rank}} @top5) == 1) {