fixed template, improved setplant iteration