V2 with cherry-picks of the changes in V1 

github can't merge this. This is basically meant to be pushed as the new master once reviewed. But it's hard to review 666 commits :)