Initial commit.  This code is appalling but it (so very barely) works.  Cleanup pending.