elbow function and best cut v2