added function for stacked polygons