(CNN) The Senate passed its tax reform bill in the early hours of Saturday morning, following a day full of Republican leaders making changes to bring enough members on board and a long night full of heated rhetoric on both sides of the aisle.

The vote was 51-49, mostly along party lines. Sen. Bob Corker of Tennessee was the only Republican to vote against the bill, citing concerns about growing the deficit.

Congressional negotiators continued to make changes to the bill -- including handwriting alterations on to the document -- up until just hours before the final vote, with Democrats sharply criticizing Republicans for not giving members enough time to read the sweeping legislation that would overhaul the US tax system.

The House of Representatives approved its own tax reform plan last month, and the two chambers are expected to go to conference to reconcile the two bills, but passing the legislation Saturday was a huge victory for Senate Republicans and President Donald Trump, both looking for significant legislative achievements.

Arizona Sen. Jeff Flake, a key holdout, announced just after noon that he would back the plan. Republicans could pass the legislation with 50 members and a tie-breaking vote from Vice President Mike Pence, but after Sen. Susan Collins of Maine announced her support Friday afternoon, Pence's would-be vote was unnecessary, as Collins' vote brought the tally to 51. Sen. Bob Corker of Tennessee is the only expected Republican to vote no.

"We have the votes," Senate Majority Leader Mitch McConnell said walking to the Senate floor following a conference meeting Friday.

Following the vote in the chamber -- which happened just before 2 a.m. ET -- Republicans bestowed a hefty number of backslaps and handshakes with lawmakers who have been integral in the process including Sen. Pat Toomey of Pennsylvania and Rob Portman of Ohio. While Senate Whip John Cornyn of Texas stood over the vote tallying sheet watching it closely, McConnell stood to the side. At one point the Majority Leader looked up at Pence, who was presiding, pointed at the VP, winked, and gave him a thumbs up.

In a public statement announcing his support, Flake said he was given promises from Senate GOP leadership and the Trump administration for a "growth-oriented legislative solution" to protect recipients of the Deferred Action for Childhood Arrivals program.

Republican leaders were racing Thursday night and Friday morning to find support for the bill, hoping to avoid a repeat of the health care bill debacle this summer that left them empty handed. Tensions were running high in the Senate, where Republican tax writers were reworking the tax bill, trying to find a way to satisfy competing interests and shore up votes.

The bill received a major boost Friday morning when Daines announced he would back the bill, after he was assured of "significant tax relief for Main Street businesses." Johnson later Friday morning issued a statement supporting the bill.

Senate Republicans met earlier in the Strom Thurmond Room of the Capitol to continue the bill's negotiation Friday morning. Collins, a key undecided vote, said GOP leaders are still "working through a few more of my issues" but as she was walking toward the conference meeting, she said, "We're making great progress."

But behind the scenes, Republican members and aides were fuming at Corker, who was demanding last-minute offsets for the GOP tax bill out of fear that it would raise the deficit. Corker's demands weren't entirely new , but were crystallized further Thursday afternoon when the Joint Committee on Taxation, the independent tax scorekeeper, announced that even with projected economic growth, the Republican tax bill still would add more than $1 trillion to the deficit over 10 years . Then, Corker learned that a trigger he demanded in the tax bill that would automatically increase taxes if the tax legislation didn't generate the growth that Republicans anticipated, wouldn't pass Senate rules and couldn't be included.

The news led to Corker holding court on the Senate floor on and off for nearly an hour as an amendment vote was held open and dozens of reporters filled the Senate chamber to watch the drama unfold from above.

As CNN reported earlier Thursday , a throng of Republicans encircled Corker and Flake as Sen. Pat Toomey, a member on the Senate Finance Committee who has cut deals with Corker on the tax bill already, stood next to Corker, explaining something at length.

At one point, the Senate's Parliamentarian came over and Corker used his hands to try to convey a point to her for several minutes.

Corker walked across the chamber to speak with Sen. Angus King, an independent from Maine. The two men looked over some papers, then walked back over the Republican huddle. Corker asked more questions. At one point Toomey grew audibly frustrated, this time standing face-to-face with the Tennessee Republican.

"Furious," one aide responded when asked how GOP senators were responding behind closed doors to what Corker did on the floor. "Didn't need to be done publicly. Didn't need to cause a scene. We know it's a problem. Fix it behind closed doors."

Right now, according to aides, staff and senators are working through several different proposals to try to address Corker's issues -- issues that grew more problematic with the JCT report.

Corker, according to aides, wants even more revenue than the trigger would've snapped into effect.

"When the trigger doesn't work, you have to come up with, I think, $350 billion," said Sen. Lindsey Graham, a Republican from South Carolina. "That makes everything different. So, we'll get there, because failure's not an option."

There were a few options for getting back the revenue, but none of them would satisfy the entire conference. One option, Texas Sen. John Cornyn floated, would be to gradually raise the corporate tax rate, which Republicans had planned to lower to 20% . That would surely upset House Republicans and Trump who had lobbied aggressively to drop the corporate tax rate to 15%. The other option was to not completely repeal the alternative minimum tax , a levy that is used to ensure wealthy individuals cannot just use tax loopholes to avoid paying taxes all together.

But Republicans were still working on how to put the pieces together.

McConnell can afford to lose two Republican senators, but with so many competing concerns, leadership will have to make tough decisions about who to appease based on the math. Flake joins Corker in sharing concerns about the deficit and GOP aides say leaders now view Corker and Flake as a package deal, meaning they either assuage their concerns, or figure out a way not to lose any other senators if they want to pass the bill at all.

Johnson had tried to lobby leadership to give so-called pass-throughs -- businesses that pass profits to owners who pay taxes on the individual side -- additional tax breaks. Collins, who was a key "no" vote on health care also must be won over. Collins has asked leadership and the Trump administration to promise her that they will support a package that she says would help stabilize the Obamacare marketplace after Republicans repeal the individual mandate in their tax bill. She has also asked leadership to include a provision that would allow individuals to deduct state and local property taxes up to $10,000.

The predicament leadership faces now isn't all that unlike the one they found themselves in on health care. If McConnell appeases Johnson and boosts the tax break for pass-throughs (which costs money), he could alienate Corker and Flake who have lobbied to make the tax bill less expensive. If he appeases Collins, he could face problems with the Senate bill when it goes to conference with the House.

Collins acknowledged the struggle ahead.

"I'm going to have more discussions with the House," Collins told reporters on Thursday evening.

This story has been updated and will continue to update with additional reporting.