Lowell was only the third Massachusetts community to be granted city government, after Boston and Salem. The population at the time was 17,633, and soon, a court, jail, hospital, cemetery, library, and two town commons were established. The first museums and theatres opened around 1840. Lowell also began annexing neighboring areas, including Belvidere from Tewksbury in 1834, and Centralville from Dracut in 1851. Daniel Ayer started the satellite city of Ayer's City in South Lowell in 1847, and in 1874, Pawtucketville and Middlesex Village were annexed from Dracut and Chelmsford respectively, bringing the city close to its present borders.