finished implementation of contour tracing.