Some fo this code is now obsolete, thanks to f62212c ; I'll be cleaning this up next.