Updated the AddBranch code to check the count of features.