Made sorting work for each type of metric (excluding poll).