added contours filtering