Mix back some of the changes from previous check-in with additional fixes