PH: Selective merge from Michael, with extra tweaks