Lots of changes; looks like the very basic behaviour works now.  Still, more changes to come.