Also including changes from master's 3b693664357606425d6c81483e9164e07c0cff1d