n*logn convex hull version works!