refactor convex hull