TEXAS has a higher share of uninsured citizens than any state in America. Until recently Shane, a 38-year-old from Houston, was one of them. “I just couldn’t afford it,” he says. Shane has HIV; his job does not cover him. Because of his illness, insurers would offer him only a costly plan with limited benefits. Such discrimination is now illegal. Since January the Affordable Care Act, better known as Obamacare, has required insurers to charge the healthy and the sick the same price. For the first time in 20 years, Shane can afford health cover.

Across town, Suezen Salinas is less fortunate. Having recently returned to college, she has no job. Her two children qualify for Medicaid, the public health programme for the poor, but she does not. Texas is one of the nearly two dozen states that did not expand Medicaid, despite Obamacare’s offer that the federal government would cover most of the cost. Ms Salinas also earns too little to qualify for Obamacare’s subsidies (which were fixed when Democrats in Congress thought all the states would expand Medicaid). So she used some of her college financial aid to buy health cover.

Health care in America is changing, thanks to Obamacare and the efforts of innovative private firms (see article). And not before time. America’s health system, the world’s biggest, involves a tangled mess of rules and a hotch-potch of public and private institutions. It combines dazzling technology with minimal cost controls and spotty coverage. In 2012 it left some 48m people uninsured despite gobbling up 17.2% of GDP, a figure that dwarfs spending in any other country and has shot up from 4.4% in 1950.

Rather than scrap this system, Obamacare rejigs it. It expands Medicaid to include millions of not-quite-poor Americans. It seeks to create a market where individuals can buy health insurance, pooling risks without the backing of a large employer. Ultimately, it aims to expand coverage and deliver better care at a lower price. Its record is mixed so far.

Obamacare created new health exchanges, where individuals can shop for private insurance and, if they earn between $11,670 and $46,680, qualify for subsidies. As well as barring insurers from charging the sick more, it requires individuals to have health insurance or pay a fine. (If it did not, people would buy insurance only when they fell ill, and premiums would shoot into space.) In some states Obamacare works well. In others, it does not. Many Republican-run states refused to expand Medicaid on the grounds that taxpayers would be stuck with the bill. That left almost 9m adults who earn less than $11,670 a year, like Ms Salinas, too rich for Medicaid but too poor to receive subsidies on the exchanges. Thirty-six states did not set up their own exchanges (as Congress had assumed they would), instead relying on the federal government to do the work. That put a lot of pressure on Healthcare.gov, the federal insurance website, which hardly worked at all when it was launched on October 1st last year. It is working better now, but problems remain. A new audit warns that more must be done to make the site secure. For now Obamacare seems to have expanded cover. Data-crunchers at Gallup, Harvard University, the Urban Institute and the Commonwealth Fund agree that the proportion of American adults who are uninsured dropped by 22%-26% from the third quarter of 2013, just before Obamacare’s exchanges opened, to the second quarter of 2014, when enrolment ended. Between 8m and 10.3m adults have gained cover. Much of this gain appears to have come from the expansion of publicly-funded Medicaid, however. Nearly 20% of adults are uninsured in states that did not expand Medicaid, about twice the share in states that did, according to the Urban Institute (see chart 2).

How many people have gained coverage through the new exchanges is unclear. Officials say that more than 8m have signed up, but this includes some who had insurance before. In May McKinsey, a consultancy, estimated that 26% of those who had bought policies on the individual market had been previously uninsured. Politically, Obamacare remains highly controversial. A poll of polls finds that 51% of Americans disapprove of it; only 41% approve. Republicans bash it in stump speeches; Democrats mention it only in passing. A lawsuit, Halbig v Burwell, contends that the law allows insurance subsidies only through state-run exchanges, not through the federal one. If the plaintiffs win, they could kneecap the entire reform. Assuming it survives legal challenges, however, Obamacare’s success depends largely on how many uninsured people eventually sign up for coverage on the exchanges. Legally, they are obliged to have coverage, but if prices are too high, some will opt to pay the penalty instead. Education should help—most of the uninsured are unaware of the subsidies available to them. But premiums matter more, and are rising, by an average of 7% across 33 states, according to PwC, a consultancy. There is broad variation. Premiums are to rise by an average of only 2.4% in Colorado, but by a whopping 14% in Tennessee, according to PwC. The next round of enrolment starts in November; many people will discover whether their premiums are to rise or fall just before the mid-term elections. Growth in health spending per person slowed from a shocking 7.4% a year from 1980 to 2009 to 3% from 2009 to 2012. It may rise again, alas. The lousy economy caused some of the recent slowdown. The government’s actuaries expect spending to jump by 5.6% this year and 6% a year from 2015 to 2023. As more Americans age and gain insurance, they will demand more health care. Shane, for example, ignored an aching shoulder and blocked sinuses when he was uninsured. Now that he has cover, he is seeking treatment. Big hospitals say they are seeing more patients: Tenet, a giant hospital firm, reported a 4% jump in patient volumes in the second quarter, compared with a year earlier.

Higher public spending on health threatens to crowd out education, infrastructure and more besides. In July the Congressional Budget Office predicted that, despite the recent slowdown, government health programmes would become the single biggest area of public spending within 20 years, and grow from 4.8% of GDP now to 8% in 2039.

America’s health system is terrible at controlling costs for two main reasons. First, insurers and Medicare usually pay doctors when they deliver many services, rather than when they keep patients well. Second, America relies on a private market of doctors and insurers, yet their costs and quality remain opaque. For decades the doctors’ lobby has fought to hide detailed data on doctors’ performance and prices. Robert Kocher and Ezekiel Emanuel report that 30-40% of top academic hospitals have contracts that bar insurers from relaying hospital prices to employers or patients. What quality measures exist are mostly tied to procedures, not results.

So patients have been left in the dark. When they have visited the doctor, they have had no idea what anything costs or that it all ultimately comes out of their wages. So they have not objected when doctors gave them unnecessary tests, or overcharged.

Thus the cost of a back scan in New York City ranges from $416 to more than ten times that amount, according to Castlight, a firm in California. A prostate-specific antigen test in Philadelphia could be $20 or $407 (see chart 3). Quality is erratic, too. Laurent Glance of the University of Rochester found that rates of complications from caesarean deliveries varied nearly fivefold among American hospitals.

Obamacare tries various ways to curb costs. For example, it urges groups of doctors and hospitals to become Accountable Care Organisations (ACOs), rewarded for keeping Medicare patients’ costs below a set limit. However, data published on September 16th show that only a quarter saved enough to earn a bonus. Obamacare also orders the health department to make costs and quality more transparent. This, too, is proceeding fitfully. In April health officials published Medicare payments to specific doctors. This revealed which doctors perform a lot of procedures. However, it did not reveal whether those interventions were appropriate or successful. Medicare’s more useful data, which would show which doctors keep patients well, have yet to be broadly released; there are worries about privacy.

A long way to go

Mark McClellan of the Brookings Institution, a think-tank, points out that insurers and doctors’ groups are testing their own versions of ACOs, which might be more successful than the government’s. Companies are also slowly lifting the veil from doctors’ costs and quality. Castlight compiles data from employers’ insurance bills, then presents prices to patients. UnitedHealthcare, Aetna, Humana and Kaiser Permanente, four huge insurance and health companies, have given reams of data to an independent research centre. Next year it will launch a website where any insured patient can log in and view quality and cost information for specific doctors and hospitals.

Patients may increasingly demand change, too. Employers are pushing workers into plans with high deductibles, which means they must pay for more care out of their own pockets before insurance kicks in. The share of workers with deductibles jumped from 55% in 2006 to 80% in 2014. This gives patients a good reason to shop around for cheaper treatment. In some cases, employers are asking workers to shop around for insurance too, giving them cash to buy coverage on privately-run health exchanges.

When patients act like shoppers, health-care providers serve them better. In August the number of retail clinics, which treat patients at malls and outside regular hours, was up 17% over last year, according to Merchant Medicine, a consultancy. Obamacare’s exchanges have inspired new insurance entrepreneurs. Oscar, started by techies in New York, tries to be the patient’s ally, swapping insurers’ usual perplexing drivel for clear information. Medicare Advantage, a complement to the traditional public scheme for the elderly, often pays doctors a capped fee to care for patients. Providers profit when patients are well and costs are cut. America’s health market has long been an example of what not to do. If it can serve patients, it just might become the opposite.