Factor out the spline_cov fit from the rest for easier maintenance/use