[WIP] Rework

This isn't complete, but the first two commits should be ready.

Known bugs:
  * Nothing at the moment.  :-)  Not extensively tested though.