Valeant (VRX)  's banks have agreed to extend the date of its credit commitment by two years, a move that boosted the company's shares midday Wednesday.  

Valeant's shares were up 4.2% to $11.13 apiece Wednesday on the news.

According to an SEC filing, Valeant won an extended maturity date of its $1.19 billion of revolving credit commitments from April 20, 2018 to April 20, 2020. The remaining $310 million of the revolving credit commitments will still mature in 2018.

This agreement helps Valeant deal with its $31 billion in debt and comes just days after Valeant's former CEO, Mike Pearson filed a suit in the U.S. District Court of New Jersey claiming that the Canadian drugmaker has refused to pay him for the three million shares he is owed.

Pearson is alleging that he is owed 580,676 shares and 2.5 million performance shares due November 3 under the terms of his separation agreement. Pearson stepped down back in May 2016. The lawsuit also alleges Valeant also owes $180,000 to Pearson for consultation fees.

According to the lawsuit, Valeant officials responded to requests from Pearson and his legal team by saying that making a payout would be "inappropriate."

"Valeant believes it would be inappropriate or inequitable in the current environment for Mr. Pearson to receive additional compensation—to the tune of millions of dollars—at a time when countless other Valeant employees have been asked to sacrifice for the good of the company and its shareholders," Valeant's executive vice president and general counsel, Christina Ackermann responded, according to the lawsuit.

This was just the latest in a series of problems for Valeant.

The company's problems began in 2015 when short seller Andrew Left of Citron Research wrote a scathing report alleging that Valeant and its mail-order pharmacy Philidor, along with one of its customers, had engaged in a scheme to improperly raise revenues.

Then last March Valeant blamed its former CFO and former controller, Howard Schiller, for misstatements of earnings. Schiller left the company, as did Pearson. Valeant has since been scrutinized for its alleged accounting problems and steep price hikes on drugs it acquired.

Most recently, Pershing Square fund manager Ackman pulled his entire stake from Valeant, taking a $2.8 billion loss.

ValueAct Capital, another activist firm, picked up some of the shares Ackman divested just days later.