Moves template constructor to TreeGen