I agree, but I'm not sure how much more reusable that would make this script. To be able to pass an arbitrary shape file with a path means that the shapefile would need to have the same mapping declared in lines 24-27.

I suppose those could be parameters as well though that would get tedious since there is only really one use case for this script.