Improve code handling special winding cases.