added a tdot function (thanks Iain)
manual merging