implemented saving contours