After 20 years of rapid growth, the number of undocumented immigrants has fallen in recent years, as states crack down on these workers and some foreign economies have improved.

There were 8 million unauthorized immigrants in the U.S. working or looking for work in 2014, down from around 8.3 million during the Great Recession, virtually unchanged in five years, according to an analysis of government data released Thursday by the Pew Research Center, a nonprofit think tank based in Washington, D.C.

The share was down slightly since 2009, the year the Great Recession officially ended, but up from 5.6 million in 2000 and 3.6 million in 1995. States with the largest number of undocumented immigrants include California (1.7 million), Texas (1.1 million) and New York (600,000).

The reason is mostly due to demographic changes. The population of undocumented immigrants in the U.S. grew rapidly in the 1990s and 2000s, the number has plateaued, says Jeffrey Passel, senior demographer at Pew and one of the lead authors of the report. “The total unauthorized immigrant population hovers at 11 million and has been flat for five years,” he says. “The biggest group of unauthorized immigrants historically has been Mexicans.” The economy has improved in Mexico in recent years and over the last four decades the fertility rate in Mexico has fallen.

More states are also using E-Verify, an internet-based system that allows businesses to determine the eligibility of their employees to work in the U.S., which has led to an increase in undocumented workers in some states and a decrease in others. “Without E-Verify, all the employer has to do is collect the information,” Passel says. “With E-Verify, they have to check their social security electronically to verify that the number is the valid number.”

From 2009 to 2014, eight U.S. states — Alabama, California, Georgia, Illinois, Kansas, Nevada, South Carolina and Rhode Island — had statistically-significant declines in the number of undocumented immigrants in their workforces.

Even though undocumented immigrants make up just 5% share of the civilian workforce in the U.S., they were overrepresented in the agriculture (17%) and construction (13%) sectors, as well as in the leisure and hospitality industry (9%). And they were under-represented in some sectors such as the educational and health services sector and the financial and information industries where workers may, for example, require licenses to practice.