[layouts] simplify tree manager code with masonry 3.1.2, add some comments