A whole bunch of changes to sdi_generic.py, pretty much rounding out an initial version.