The eunuch Wei Zhongxian (1568–1627) dominated the court of the Tianqi Emperor (r. 1620–1627) and had his political rivals tortured to death, mostly the vocal critics from the faction of the Donglin Society. He ordered temples built in his honor throughout the Ming Empire, and built personal palaces created with funds allocated for building the previous emperor's tombs. His friends and family gained important positions without qualifications. Wei also published a historical work lambasting and belittling his political opponents. The instability at court came right as natural calamity, pestilence, rebellion, and foreign invasion came to a peak. The Chongzhen Emperor (r. 1627–44) had Wei dismissed from court, which led to Wei's suicide shortly after.