Code working with spline interpolation