Also including changes from master's 1bce2042b7286eba066ed1276d652ab318690522