Added example dataset, removed spline function, rewrote extrema in R.