MAINT: changed to np.lexsort instead to sort by y as secondary