Complex sentence: When the Popes moved to Avignon (14th century), the Cardinal Palace ruined, so that, with the return of the Popes in Rome (Pope Martin V), a restoration was necessary.
Split into simpler sentences: When the Popes moved to Avignon (14th century), the Cardinal Palace fell into ruin. Thus, upon the return of the Popes to Rome withPope Martin V, a restoration was necessary.