Moved getLabel function to TreeController.