Tidied things up a bit.  Now, I think, this is ready to be merged.