addBranchNode and addLeafNode