Added function to extract polygons