Regardless of their sectarian affiliations, who did the Ming grant titles to?