Massive refactoring to make use of fiona and rasterio