4.0 working branch

Seems ready enough to become mainstream....