Cleaned up code and removed old B-spline algorithm.