Add an option that makes it possible to ensure that the last point is exactly for Tmax; make sure that we never exceed Tmax

Rewritten.