Justin Bieber pleaded guilty on Wednesday to lesser charges of careless driving and resisting arrest to avoid a DUI conviction in Florida, The Associated Press reports.

The 20-year-old was charged with driving under the influence, resisting arrest and using an expired license after police suspected him of drag racing and arrested him in January.

The agreement  requires the Canadian singer to attend a 12-hour anger-management course, watch online videos about tragic drunken driving cases and donate $50,000 to charity.

As part of the deal, the state is dropping the DUI charge.

In July, Bieber pleaded no contest in a Los Angeles court to misdemeanor vandalism for pelting a neighbor’s home with eggs and was sentenced to two years’ probation.