Adding template function for getting branch values