Justin Bieber has avoided jail time in his Miami Beach D.U.I. case thanks to a plea deal in which he has promised to complete a 12-hour anger management course. The 20-year-old singer also agreed to make a $50,000 charitable donation, reports TMZ.

Prosecutors will allow the singer to plead guilty to careless driving and resisting an officer without violence, according to the Miami Herald. This is Bieber's second plea deal this year, as he previously pled no contest to misdemeanor vandalism for egging his former neighbor's Calabasas home. As a part of that deal, he was placed on two years probation, ordered to pay his neighbor $80,900 and he was also ordered to attend anger management classes.

Bieber's attorney, Roy Black, was worried that the Biebs would be placed on probation for this case as well, which could be a major problem if Bieber was charged with even a minor offense. You know, like a noise citation for throwing a party at his new Beverly Hills pad? However, due to some shady circumstances (i.e., the cop reportedly lied about Bieber drag racing and about smelling alcohol on Bieber's breath), prosecutors accepted a lesser plea.