Refactored the code to avoid redundancy. Instead of defining each spline individually, this is done recursively with a for loop.