add TR changes from @aij