ported tr from jSuneido