Make some functions protected on the treenode

add documentation, add assertions