Refactor txdoc