Rebased to latest master.