House Speaker Nancy Pelosi (D-Calif.) kept talking Friday, trying to buy more time until she got the go-ahead. After nearly 20 minutes, Keith Stern, who runs operations on the House floor for Pelosi, slid her a note.

“We have a quorum. You can close,” it read.

With that, a nearly two-week journey to pass a $2 trillion rescue bill for millions of Americans, hospitals, first responders and the U.S. economy, came to an end. A bipartisan leadership effort outflanked one renegade lawmaker’s bid to upend the legislation, beginning with a high-technology call-out to rally hundreds of lawmakers to the Capitol with only hours’ notice and ending with a math count using elementary-school skills.

In the process, Pelosi, working hand in hand with Minority Leader Kevin McCarthy (R-Calif.) and Majority Leader Steny H. Hoyer (D-Md.), mapped out a history-making moment in which lawmakers took over the empty public galleries above to create a safe social distance for which to cast a loud voice vote in favor of the legislation.

The leaders spent the last several days knowing that Rep. Thomas Massie (R-Ky.) would likely object to any unanimous vote, forcing all 430 members to trek back to Washington for a formal recorded vote — something they deemed as defying federal health guidelines recommending limited travel and no gatherings larger than 10 people.

“What is the result you want? Now engineer back from that, what is available to you? We knew we would get this done,” Pelosi told reporters after the fact, explaining how they came up with the first-of-its-kind use of the public gallery for lawmakers to vote.

The speaker and McCarthy had initially discussed passing the legislation on unanimous consent, a vote of acclamation without any actual count. But some staunch conservatives signaled to the GOP leader that they were uncomfortable using the parliamentary procedure usually reserved for naming post offices for what would be one of the most important pieces of legislation they would ever vote on.

By early Thursday, they settled on a voice vote, in which Pelosi planned to have a debate with a small group of senior lawmakers and anyone who opposed the bill could show up and explain in the debate. The bill, they thought, would then easily pass as those yelling “aye” would clearly outnumber those shouting “no.”

But Massie knew the House rules and, if he called for a vote, leadership would have to establish that a majority of the members — the magic number is now 216 — were present to thwart his effort.

So, by Thursday evening, Democratic and Republican leadership teams summoned their rank and file, asking those who could make it, those who were healthy, to get to the Capitol by late Friday morning.

Health concerns remained paramount, and no one wanted to pack several hundred lawmakers onto the House floor. Hoyer said that his first suggestion was to establish a quorum, as the majority is called, by walking groups of 30 onto the House floor and recording their presence, then having them leave out the other door so another group of 30 could enter to be recorded as present.

But the parliamentarian said that the rules needed those lawmakers to be present in the actual House chamber. “He was very concerned about having a quorum that was visibly present,” Hoyer said afterward, explaining the ah-ha moment of using the public gallery. “That’s the first time that’s ever been done.”

After Massie made clear he would force Pelosi and McCarthy to produce a quorum, top security officials entered the House floor and consulted with Pelosi and Hoyer, pointing up above to the public galleries.

There are roughly 600 seats that ring three-quarters of the chamber — the other quarter reserved for the media — and the public has been banned from entering the Capitol for more than two weeks, out of fear of the rapidly spreading coronavirus. The House floor, when packed for an event like a State of the Union address, can accommodate nearly 600 people.

So, just past noon, aides started opening the doors above to the public gallery, and one by one, lawmakers started filling those seats above the House floor, leaving plenty open to ensure a safe social distance.

The fear in the room was evident. Several members wore surgical gloves. Others went to great lengths to place themselves far from others. Some held their hand over their face as they passed other lawmakers or staff.

To satisfy the parliamentarian’s concern, leadership teams had to make sure that it was a clearly visible majority of the House on hand. And in the quirky nature of chamber rules, they had to make sure no one else stood as Massie made his request.

Senior aides walked around the room prepping lawmakers for the tricky vote, waving their arms in a downward motion, reminding those in the gallery above to stay seated when Massie asked for his vote.

As she began her closing remarks, Pelosi acknowledged that she would talk until she had been assured they had more than enough lawmakers on hand.

The quicker members got into the chamber, she told the House, “the shorter my remarks will be.”

Lawmakers cheered.

Rather than the normally intricate whip operation, senior aides in both parties did the least technological count possible — pacing the room and using their fingers to count in the air, mouthing each new member present.

By the time Pelosi spoke, more than 90 lawmakers had taken seats up above, spread across 16 galleries in the House. Some took pictures or video on their phones of the historic moment, a view of the chamber they almost never see unless friends are visiting and they decide to watch the proceedings from there.

The House floor appeared about one-third full, with some aides estimating maybe 250 lawmakers total were on hand.

Finally, Stern slid Pelosi the note telling her the count was solid.

They called the voice vote.

Rep. Anthony G. Brown (D-Md.), a favorite of Pelosi’s for his parliamentary expertise, sat in the presiding officer chair and declared that the ayes had won.

Massie asked for his recorded vote, but everyone remained in their seats.

“The motion is adopted,” Brown said, banging the gavel amid cheers on both sides of the aisle.

McCarthy elbow bumped the top aide in the whip operation; Hoyer elbow bumped Rep. Kevin Brady (R-Tex.).

A few minutes later, Pelosi and McCarthy held an unusual bipartisan ceremony to sign the bill and send it on to the White House — but not before one final health admonishment.

“Don’t forget,” Pelosi said. “Wash your hands, 20 seconds. Hydrate. Hydrate. Hydrate. Six feet apart.”