removed persistent objects from constraints

now only one unique polygon is used for references.

bug fixes and some cleanup