Add changes from Nick's PR