refactor and add convex hull to make polygon from points