Merge with @jreback's #5422