A new study from Washington state proves that the federal background check system is working. Since 1998, federal law has required licensed gun dealers to conduct a background check for every firearm purchase. Prospective gun buyers are screened against the FBI’s National Instant Criminal Background Check System (NICS), which blocks gun sales to those people unfit to possess firearms under federal law—including felons, domestic abusers, and the severely mentally ill.

The study, released by Everytown for Gun Safety using FBI data, tracked attempted gun purchases since 1998. Out of the 40,000 gun sales that were prevented using the system, 24,000 convicted felons attempted to purchase guns. 6,000 of the attempted purchases came from verified domestic abusers.

The data, which was obtained from the FBI by Everytown through a Freedom of Information Act request, analyzed the number of gun sales in Washington State that were denied between 1998 and 2013, by type and over time.

Below is a chart of gun denials recorded in the study:

Washington state denied gun applications

But not all the news is good. Despite the stringent background check requirement, criminals still have ways to evade detection and illegally purchase firearms. Everytown’s analysis also shows that the share of denied gun purchases fell by half between 2000 and 2013.The researchers say this suggests that criminals may be seeking guns from alternate sources. There are a few loopholes that can be used to circumvent the background check. Usually the unlicensed sales take place online, at gun shows and even in parking lots from strangers. According to Everytown,

“In a September 2013 investigation of illegal online gun sales, Felon Seeks Firearm, Everytown found that 1 in 30 people seeking guns from unlicensed sellers on the national website Armslist.com had a criminal record or domestic violence history that prohibited gun ownership. This is nearly four times the share of people seeking firearms at licensed dealers who are prohibited and blocked by the background check system.”

Initiative 594, a Washington State ballot measure to keep guns out of the hands of dangerous people, would close the background check loophole and prevent illegal sales of guns.

“Everytown’s analysis proves what we already know: That Washington’s existing background check system is working, with gun sales to more than 40,000 prohibited purchasers, including at least 24,000 felons and more than 6,000 domestic abusers, already blocked,” said Eileen Bennhoff, a member of the Washington chapter of Moms Demand Action for Gun Sense in America.

“Still, with prohibited gun purchasers continuing to buy guns illegally through unlicensed sellers—such as online, at gun shows or from strangers in parking lots—we can do more to keep our kids, schools and communities safer from gun violence by voting Yes on Initiative 594 this fall. Initiative 594 will close the dangerous loophole in Washington’s background check system by making sure everyone undergoes the same background check when buying a gun—regardless of where they buy it and who they buy it from.”