Rewrite of contour conversion