More speed improvements. Doubled number of sample points and removed linear segment approximation test.