Find Tmax and pmax indices right at the end - much simpler

Signed-off-by: Ian Bell <ian.h.bell@gmail.com>