add append and subtree function