It is hard to imagine things getting any worse at the Securities and Exchange Commission than they were when the Bernard Madoff and Allen Stanford scandals came to light four years ago, and even some of the agency's harshest critics now say things have gotten a whole lot better.
"They're a learning agency now, where they were an anti-knowledge agency," said independent fraud investigator Harry Markopolos, who testified in 2009 that he "gift-wrapped" the Madoff Ponzi scheme for investigators, only to have his tips virtually ignored.
"They've gotten much better," Markopolos told CNBC in a telephone interview. (Read More: Bernie Madoff's Crime and Punishment )
Former SEC Inspector General David Kotz, who wrote several scathing reports about the agency, agrees it has vastly changed.
"I think there's more specialized training and experience," said Kotz, now a Director at Berkeley Research Group in Washington. "It is a better place than it was four years ago."
The changes - in the structure of the agency as well as in the morale of its 3,000 employees-have prompted the SEC to let down its hair a bit, allowing CNBC unique access inside the 79-year-old agency. (Read More: Allen Stanford: Descent from Billionaire to Inmate # 35017-183 )
With the SEC's transformation now well underway, two of the people most responsible for the changes are moving on.
SEC Chairwoman Mary Schapiro, who took over the agency at perhaps the lowest point in its history in 2009, has already left, replaced by Commissioner Elisse Walter.
Schapiro's hand-picked Director of Enforcement, Robert Khuzami, is leaving as well, after completely restructuring the agency's most important, highest-profile division. Five specialized units now police specific segments of the industry, such as municipal securities issuers, structured products and asset managers-making enforcement agents "cops on the beat" instead of generalists. (Read More: SEC Enforcement Chief Khuzami Departs )
Khuzami said in an interview that the specialized units can bring targeted cases that send a message to the broader financial community.
"It's kind of like the Rudy Giuliani law enforcement approach in the '80s in New York City where, you know, you go after turnstile jumpers and squeegee men and other sort of low intensity criminal activity on the theory that those are the folks that may be inclined to engage in more aggressive or more egregious misconduct," Khuzami said.
But critics say in the process, SEC enforcers have missed much larger crimes that occurred during the financial crisis. No major Wall Street CEOs have been accused of fraud, either in civil cases by the SEC or criminal cases by the Justice Department. (Read More: Inside America's Economic Crisis )
The criticism is pointed for Khuzami, a former federal prosecutor, who came to the SEC from Deutsche Bank (XETRA: DBK-DE) , where he was General Counsel. But he defends the enforcement community's handling of the financial crisis.
"There's no denying a great deal of loss and pain and suffering resulted from the financial crisis," Khuzami said. "But the issue for enforcement authority is how much of that was a result of fraud and misconduct as opposed to other bad things but that are not illegal?"
"There was certainly misconduct and we're going after it," Khuzami said. But he said in many cases, banks were protected by disclosures carefully crafted by attorneys. It is not lost on him that he was once one of those attorneys at Deutsche Bank.
"If you buy an investment product and you're warned of a risk - that something might happen and that thing, in fact, comes to pass - the law says the person who sold that to you hasn't violated the law."
As Director of Enforcement, Khuzami recused himself from matters involving his former firm. And one of the highest-profile cases he did take on involved the very issue of disclosure. In 2010, Goldman Sachs agreed - without admitting guilt - to pay a record $550 million to settle allegations of inadequate disclosure in a collateralized debt offering.
In all the SEC said 150 individuals and entities were charged on Khuzami's watch, and more than $2.6 billion has been recovered. But Khuzami said he leaves plenty of unfinished business, including the continuing crackdown on insider trading, regulation of hedge funds, high-frequency trading, as well as the general impression among many investors that the game - the markets - are rigged. (Read More: Inside the Complex World of Computer-Driven Stock Trading )
"I think they have a reason to be concerned," he said. "I think that whether or not it's rigged in the sense that it's fraudulent, that's one question. But even if not fraudulent I think there needs to be greater transparency around some of these practices."
But beyond individual cases and investigations, former Inspector General David Kotz says the new leadership at the SEC will face an even bigger challenge: keeping the momentum going.
"Mary Shapiro and Rob Khuzami and others brought the agency back from discussions about whether it should continue to exist," Kotz said. "Now, you know, that excuse is gone."
Whistleblower Harry Markopolos agrees there is still much work to do, but he too is encouraged. (Read More: Here's the Next 'Madoff Fraud': Whistleblower )
"From small acorns, mighty trees grow," he said.
Tune In: Our special series Crime & Punishment: Inside the SEC begins Tuesday on CNBC's " Squawk on the Street ," 9am-12 noon ET.
-By CNBC's Scott Cohn; Follow him on Twitter: @ScottCohnCNBC
- Allen Stanford: Descent from Billionaire to Inmate # 35017-183
- SEC Enforcement Chief Khuzami Departs
- From Boom to Bust: The Crisis Explained
- Here's the Next 'Madoff Fraud': Whistleblower
- Follow ScottCohnCNBC on Twitter
image: © Emmanuel Huybrechts