join this hanging development into the master

there are a couple of good things in this commit, which I should accept in the main line.