Commented out old Tmax scheme.
Added option to keep Tmax fixed.
Fixed and improved code.