Introduce helper methods to make the TreeBuilder class more readable.