Forward-port any of the v4.0 changes done in this project that are still applicable to the master branch.