change toTr algorithm