finalized up to the writing of the output shapefiles.