Also including changes from master's 7c530926fd5a3d8ba444e2cb1bdc504d44300d3a