Refactoring Contour and ContourSet.