add maximum-by and minimum-by
improve performance of unqiue