Do you have patterns that consistently need to be reorganized based on configuration changes? Why use Code to dictate qty when you could simply start a pattern with "Qty of 1" and then develop the rules from there? I had a configuration that has complex rules for Qty changes in patterns and as I had spent hours and hours trying to chase the qty up and down, I realized if I made my template with just qty of 1 it created a suitable and yet more effective environment for configuration edits. Sometimes there can be hundreds of components in a pattern, but why make the code for all of these if you only need it for one configuration? Start at 1 for the pattern QTY, and watch your code shrink and your models stabilize as you can suppress that pattern much easier......