Curve fitting script.