Two weeks after Democratic Assembly Speaker Vincent Prieto called off a vote on the bill for his aid package, on Monday, New Jersey lawmakers agreed on a rescue package for Atlantic City to keep the iconic resort city on New Jersey’s Atlantic coast from running out of money.

Senate and state Assembly leaders reached a deal on a package designed to help the nearly broke Atlantic City, allowing for five months to formulate a plan for balanced budgets that will cover the next five years. The deal eliminates, if only temporarily, the threat of a state takeover, as well as resolving a bitter political feud that has been going on since January and managed to push the struggling resort that much closer to bankruptcy. Plans to pay its firefighters and police with IOU’s had been drawn up by the city, which is already paying city workers one time a month in order to conserve the little cash it has.

A temporary loan of approximately $60 million would be given to the city, it would be able to offer early retirement to all its employees, and it would retain its collective bargaining rights, which would have been lost under previous proposals. Even if voters choose to authorize casinos in northern New Jersey, casinos would not be permitted to opt out of payment instead of the taxes plan.

Prieto, said, “Unlike the initial bill, this pertains only to Atlantic City and is not an immediate state takeover,” according to the Associated Press. Prieto has been criticized for not coming through on an aid package this year as he fought to keep unionized public worker’s bargaining rights. He added, “Instead, Atlantic City’s locally elected officials will get the chance to right the ship.”

The changes were approved on Monday by an Assembly panel and the package is expected to receive final approval on Thursday in both houses. It will then be sent back to Republican Gov. Chris Christie, who has vetoed Atlantic City aid packages twice in recent years. Commenting on Monday’s deal, Atlantic City Mayor Don Guardian said the deal is “very fair,” and, “It’s up to us now to keep our sovereignty. The hope of partnering with the state helping us but holding our feet to the fire is the way to move forward. I’m going to have a much more blessed Memorial Day weekend.”

For the remainder of 2016, temporary loans of $30 million will be given to Atlantic City; $30 million will be used for debt leftover from 2015, and an additional $15 million for next year. Each year, the city would also be able to receive at least $120 million from casinos under a bill designed to allow payment in lieu of taxes that would be in effect for 10 years.

The original Senate aid package that caused the impasse would have given the state of New Jersey most of the authority over the finances of Atlantic City, which would include the right to renegotiate debt as well as break contracts, sell off any assets of the city, dissolve boards or agencies, and the option to file for bankruptcy, in just over four months. The state still has the power to do that, but its Community Affairs department would first have to determine that the plan Atlantic City formulates is not capable of delivering the desired effect. Before the state can take over, that determination would be able to be appealed by the city.