Working on number_of_branches function