speed up of getTerminalTaxa by 2 orders of magnitude