type hint
extracted addChild method
extracted TreeBuilder class