adding the branching procedure in the NTM