refactored creating contours by set of included nodes