extract contour new code works