Re-merge of #1906

#1906 went unmergeable; this brings it back.