Reviewed-by: darcy, ramap
Forward port of changes from the 6-open train. Reviewed-by: darcy, ohair, tbell