Add children function to TreeNode.