Scaling closed curves until they nest - Kangaroo

I am trying to develop a script where a series of closed curves (rectangles) are nested within a boundary. The individual closed curves are scaled until they curvecollide with each other and the bounds.

When I tried to do this, however, the line-length (spring) goal occurs out of sequence with the curve collide. I am trying to maximize the size of the squares by setting a high value for its desired side length, but the curvecollide rule runs on the squares before they are scaled up through the spring goal.

Could someone with more kangaroo experience please point me in the right direction of how to accomplish this?

packing a triangle.3dm (155.9 KB)
packing a (19.0 KB)

Shameless self bump