Moved remove_all_contours() calls inside update_contours.