Improved docstring and comments
Some renaming to make the logic tree management more general