implemented cubic spline