1.6 for 1.7

This should contain all the latest 1.6 changes.
There were many merge conflicts, so please look closely.
CI tests are still running, but should be ok. I'll post an update when they finish.