Some Improvements in LayerTreeBuilder and GPTreeBeforeExpand