Added end to function declaration in sort_pair_mean