better path cutting algoritm.

still need to add cutting out middle of pattern