tweaked code to functionalize and integrate the outsourced convex geometry code