added sorting an array of points