Added contour extraction.