Everything below here is "playground" code.  I'm not sure reviewing this, beyond a cursory check, is a good use of time at this moment.  This is internal, test-only code.