HARRISBURG - Pennsylvania lawmakers moved Monday to put final touches on a bill to legalize medical marijuana, reviving a long-debated measure that had stalled near the finish line last month.

The Senate agreed to add a few technical changes to the House-approved bill. Republican leaders who control both chambers say that barring last-minute objections, the legislation could land on Gov. Wolf's desk for a signature this week.

"I believe everyone is acting in good faith, but I will be holding my breath until the final vote is taken," said Sen. Daylin Leach (D., Montgomery), who, with Republican Sen. Mike Folmer of Lebanon County, has championed the bill.

If the measure becomes law, Pennsylvania would join New Jersey and 23 other states that have approved medical marijuana. It would allow people suffering from cancer, epilepsy, multiple sclerosis, intractable seizures, and other conditions to obtain marijuana in pill, oil, or ointment form at dispensaries statewide.

After years of debate and lobbying by advocates - many of them families with children who are chronically ill - the House last month approved the measure. But the bill it passed and returned to the Senate was a heavily revised version of the one that had cleared the upper house, and advocates became concerned that the differences between the two could slow or muddle the process of getting the drug into the hands of patients.

Others feared that if the Senate continued to tinker - passing changes that stirred another House debate and vote - it would give opponents of the bill another shot at torpedoing it.

Under the legislation, dispensaries, as well as those who grow and process medical cannabis, will have to be licensed by the state. Doctors who prescribe it as a treatment will have to register as practitioners, and patients who want to use it will be given ID cards that would be renewed annually.

The Department of Health would establish an advisory board and oversee the system, which could take more than a year to get up and running.

Critics have argued that marijuana is not approved for medicinal purposes by the U.S. Food and Drug Administration, and that legalizing it for medicinal purposes would open the door to more recreational use.

But several senators said Monday that the proposed changes were highly technical and would not affect the bill's substance.

"We've worked through the weekend . . . and we think we are at the point where we have complete agreement," Senate Majority Leader Jake Corman (R., Centre) said.

Senators also have a backup plan: If it appears by Tuesday that their changes will not pass the House, they signaled that they could revert to the original House bill, approve that, and send it on to Wolf.

"We have to see what they send us," House Republican spokesman Steve Miskin said. "Our goal is to get a bill to the governor's desk."