Also including changes from master's b1533320427505657f4e3b3210b250783d347aec