shapefile WIP for comment

These nested fold lefts are tough to read.  Maybe add some intermediate variables or break the nested fold left into its own function?