Factor out minCut