Thank you for the pull request. Just one comment for the tm extension - this is really a lot of duplicated and non-trivial code for this particular function, which doubles maintenance tasks for bug fixes etc.. I assume the difference between the two functions (t_append_branch, t_append_branch_by_contact) is rather small? I would suggest move the common parts to one new function, and then call it from the old and the new one.