Fixed regressions that led to incorrect output

Also, changed TPts from reference to a simply object type.