Add average rankings.
Remove some duplication.