Up until now, Uber CEO Travis Kalanick was a poster child for how to build a hugely successful company and then screw it up with a ruinous corporate culture. Today, he and Uber symbolize something else: How to grow up. It's about time. Leaving Uber, as he just announced he would, is the most mature thing he could have done.

By now, you probably know the story. Uber started out as a brash young company that defied the (written and unwritten) rules that had governed the staid old taxi business going back to the days of horse-drawn carriages. Uber was the very definition of disruptive. It fought hard and played hard, never shying away from a fight, whether with governments or disgruntled drivers.

That take-no-prisoners approach helped build Uber into a company now valued at $70 billion. But with more than 12,000 employees and tens of thousands of drivers, Uber's aggressive culture became a liability. Driver lawsuits, the revelation of software intended to fool law enforcement in places where Uber was operating illegally, and legal challenges for its self-driving cars (in addition to running a red light and getting in an accident) were just some of the troubles that resulted.

The worst blow, however, was dealt by former engineer Susan Fowler. She published a blog post describing in detail a culture that not only protected managers who sexually harassed female subordinates, but also punished women who insisted HR do something about it. In her case, that punishment took the form of a performance review retroactively changed for the worse, resulting in reduced opportunities.

Fowler's post stunned Uber insiders who had been oblivious to these issues and empowered those who had experienced them to speak out in support of Fowler. The combination apparently became the wake up call Kalanick and Uber needed. Kalanick is one of the world's most-disliked CEOs right now, and Uber is one of its most-disliked companies. But a better future may be ahead for both, because there are many things he and Uber's board are doing right. The company's response to its current crisis provides leadership lessons for us all:

1. When you've done wrong, admit it and apologize--fast.

Hours after Fowler's post went viral, Kalanick took to Twitter. He didn't say (as an attorney might have recommended) that Uber was looking into the allegations and attempting to find out what really happened. He didn't withhold comment or question the accuracy of Fowler's account. What he tweeted was this: "What's described here is abhorrent & against everything we believe in. Anyone who behaves this way or thinks this is OK will be fired."

2. Get help from an objective third party.

Uber hired Covington & Burling, former Attorney General Eric Holder's law firm, to investigate independently and make recommendations. Kalanick also invited board member Arianna Huffington to join him at the all-hands meeting to discuss Uber's culture problems, where she famously said the company would no longer tolerate "brilliant jerks." Critics complained that Holder is too much of an insider, having counseled the company during some of its many legal challenges. Also that the Huffington Post has been accused of mistreating its own employees. They questioned where these two people were the best choices for turning Uber around.

The critics were wrong. Whatever the shortcomings in her own company, Huffington's intervention appears to have been good for Uber. Covington's recommendations are now in, and offer a blueprint for how to effect real change, covering everything from tying executive compensation to diversity and ethical practices to having the company's catered dinner earlier in the evening so that employees can go home to their families sooner. Uber's board says it will act on these recommendations. If it does, it will wind up with a dramatically different company than it had before.

3. Recognize if you're part of the problem and take action.

Kalanick has been urged to fire himself. He began with the next best thing, announcing, along with the investigation results, that he would take an unspecified leave of absence. Kalanick has been synonymous with Uber from the beginning, so this move took a lot of guts, although it likely also had to do with the recent death of his mother and injury of his father in a freak boating accident. But under pressure from investors, he amended his plans and resigned from Uber permanently.

Uber's voting stock is structured to give Kalanick a great deal of control, so this was his decision and no one else's. There's nothing he could have done to more clearly communicate that Uber won't go back to business as usual. And that he loves the company he created enough to let it go when he himself was dragging it down.

4. Fire your buddies if they're part of the problem too.

Uber reputedly had an "A-Team" of executives who were pals with Kalanick and untouchable no matter what they did. One improperly obtained medical records of a woman who said she was raped by an Uber driver. Another, Emil Michael, Kalanick's second-in-command, floated the idea of hiring investigators to distribute personal information about journalists who were critical of Uber. Both are now gone from the company.

5. Don't stop there.

Also now gone are 20 other executives who Uber says were part of its sexual harassment and discrimination problem. That's a great start. But if Uber's board is serious, it should also remove billionaire board member David Bonderman. At Uber's most recent all-hands meeting, Huffington noted that the board had recently added a second woman besides herself and that this was a good sign because data shows when there's one woman on a board, there's likelier to be more.

Bonderman interjected: "Actually, what it shows is that it's much more likely to be more talking."

I don't know whether to be more astonished that he said this at a meeting that was specifically focused on addressing Uber's sexism--or that he said it when he knew he was being recorded--or that he actually interrupted Huffington to complain about women talking too much. (Perhaps in his view, any amount is too much.)

He immediately apologized, an apology that Recode founder Kara Swisher refused to print, saying "he does not deserve it in any way." If, as he says, he truly regrets the remark, and if Uber wants to show the world that it is actually capable of change, and not just "optics" as Fowler claims, he ought to leave. I'm sure his apology was genuine, but Uber's board needs people who are smarter than this. (Update: Bonderman did indeed resign his board seat later the same night.)

6. Have values that mean something.

At too many companies "corporate values" are mainly used as the basis for attractive posters in the lobby and have little or nothing to do with how the company operates. At Uber, the corporate values actually mean something. There are 14 of them, and they include things like: "Always Be Hustling" and "Toe-Stepping" clearly intended to produce exactly the no-holds-barred culture that has characterized Uber.

That's good, in that changing those official values has the potential to change actual behavior. The company's leadership should take that opportunity and rewrite those values, as Covington recommends.

7. Look in the mirror.

It's very easy to feel superior to Uber right now. The fact is, the problems women face in the workplace are not limited to that company. Uber software engineer Aimee Lucido blogged that she herself has encountered sexual harassment--not at Uber but at Google, a company that the rest of Silicon Valley admires.

Silicon Valley itself is the problem. It was supposed to be the birthplace of a new way of doing business, more modern, more informal, more humane, more earth-friendly, and generally more evolved than established Corporate America. Instead, there's a "brogrammer" culture, dominated by white men from wealthy families and elite colleges, and even more unwelcoming to women and people of color than Wall Street is.

As Lucido writes, "Like it or not, Uber is going to be an important company." With the world now watching, it has the opportunity to also be an important force for positive change in an industry that badly needs it.