working knot-path funtion