In August 2012, San Bernardino filed for Chapter 9 bankruptcy, with more than $1 billion in debt. The move froze the city's payments to creditors, including its pension payments to the California Public Employees Retirement System for nearly a year. Key changes the city made during the bankruptcy process included: outsourcing its fire department to the county and re-writing the city's charter to provide a more clear chain of command. San Bernardino became the largest city at the time to file for a Chapter 9 bankruptcy, superseded by Detroit's filing in July 2013. Following a judge's approval, the city emerged from bankruptcy in February 2017, making it one of the longest municipal bankruptcies in the United States.