Refactored sf-items-tree to improve the code and the testability