Change to TreeMap instead of HashMap so that hats would be sorted.