Due to Song's enormous population growth and the body of its appointed scholar-officials being accepted in limited numbers (about 20,000 active officials during the Song period), the larger scholarly gentry class would now take over grassroots affairs on the vast local level. Excluding the scholar-officials in office, this elite social class consisted of exam candidates, examination degree-holders not yet assigned to an official post, local tutors, and retired officials. These learned men, degree-holders, and local elites supervised local affairs and sponsored necessary facilities of local communities; any local magistrate appointed to his office by the government relied upon the cooperation of the few or many local gentry in the area. For example, the Song government—excluding the educational-reformist government under Emperor Huizong—spared little amount of state revenue to maintain prefectural and county schools; instead, the bulk of the funds for schools was drawn from private financing. This limited role of government officials was a departure from the earlier Tang dynasty (618–907), when the government strictly regulated commercial markets and local affairs; now the government withdrew heavily from regulating commerce and relied upon a mass of local gentry to perform necessary duties in their communities.