used c++11 for each loops wherever possible
optimized the constructor of the natural spline based on profiling results