added contour finder algorithm