Implement secondary sort.