Philip V, then, built the University of Cervera and closed the rest (the Nueva Planta decrees). The creation of the university gave an economic boost to the town, basically (among other reasons) because students lodged in the town. In 1842 the University was relocated to Barcelona, which portended an important economic loss. However, when train service arrived in the town in 1860 along with improvements to some public services (such as the water supply) and as the establishment of some industries and an important wine trade, there was an improvement in the local economy. When the Phylloxera arrived, this caused a lot of people with vineyards to go bankrupt, due to a major crisis with the Cervera wine trade, which recovered somewhat with the creation of the Sindicat Agrícola (1919).