refactor the spline code: merge everything into one class