fixes #28

Ok, this time is seems to have rebased properly.  Not sure what went wrong with the last rebase.

As before, I'll start leaving comments on individual pieces.