Also including changes from master's 23e5f30a46f69da3144f857067867f65dd8b154a