contour detection added