tense -
For multiple NIC's your could create loop structure under section 4 that looks at $KeyName and $NicType variables, changing the value '0' upward.

Have not tested, since not my configs, but again should point you in the right direction. Perhaps someone else on the board has solved this item?

Bill