added ability to have multiple splines- totally made code ugly