new contour extraction code done