Restructured TS map computation

As close to final as it could get today.
Please add line break to avoid long line.