This merge request integrates the changes made in my (primarily) black hole development branch. There are some more experimental features in there that we likely do not want to include, so feel free to pick (and adapt) what seems appropriate (a copy of this development branch is kept at yb-bhdev).
The main elements are:
Also (added late):