Added method to get the best branch match