UNTIL recently a good place to catch forty winks amid the din of Mexico City was in one of the country’s somnolent legislative palaces. Cameras have often caught congressmen snoozing on the job, between games of Angry Birds on their taxpayer-funded iPads. But the past few months have seen Mexico’s legislators jolted awake. Enrique Peña Nieto, who became president on December 1st, has set a furious pace, pushing through reforms designed to correct some of his country’s long-standing structural weaknesses.

Out of government, Mr Peña’s Institutional Revolutionary Party (PRI), which ran Mexico for seven uninterrupted decades until 2000, had acted as an obstacle to reform rather than an instigator. Before last July’s presidential election the party did its best to block the proposals of Felipe Calderón (who in any case proved to be inept at constructing consensus). After Mr Peña’s victory this changed, with the passage of a labour reform that the PRI had previously blocked. An education law in February claws back control of teachers’ hiring and firing, previously the preserve of the teachers’ union. The new president sent a powerful signal to dissenters when the union’s leader, Elba Esther Gordillo, once a leader of the PRI, was arrested on charges of embezzling more than $150m of union funds (an allegation she denies).

Next came a shake-up of telecoms and television, passed by the lower house in March and expected to be passed by the Senate soon. Telecoms are dominated by Carlos Slim’s América Móvil, with 80% of landlines and 70% of mobile-phone and broadband connections. In television, Televisa has about 70% of free-to-air viewers and half of pay-TV subscribers.

Mr Peña proposes a new regulator with powers to implement asymmetric regulation (for instance, making Mr Slim pay higher interconnection fees than his tiny rivals) and to force dominant companies to divest. Two new free-to-air television channels are planned, with Televisa and its sole competitor, TV Azteca, barred from the auction. New rules could force Televisa to sell its popular content to rivals and to carry competitors’ signals. Rules restricting foreign investment would be relaxed.

América Móvil and Televisa’s share prices dropped on the news. But many fear that they may turn the proposed changes to their advantage. Each has been angling for a slice of the other’s market. Televisa, which already offers broadband through its television cables, last year bought half of Iusacell, a small mobile-phone operator. Mr Slim, who sells pay-TV in much of Latin America, has been edging into Mexican television through a marketing alliance with Dish, an upstart satellite provider. On March 22nd América Móvil said it had acquired the rights to broadcast the 2014 and 2016 winter and summer Olympics in Latin America (except in Brazil, which is hosting the summer games).

The proposal amounts to “a very good reform on paper”, says Agustín Díaz-Pinés, a telecoms expert at the OECD, a Paris-based rich-country think-tank. Last year the OECD published a report which sharply criticised Mexico’s “dysfunctional” telecoms—the cause, it said, of a welfare loss equivalent to 1.8% of GDP per year. Many of the OECD’s recommendations are in the reform. But Mr Díaz-Pinés warns that effective implementation will be vital. Regulators have hitherto been bossed around by the firms they were meant to keep in line.

A legal reform enacted on April 2nd ought to help. The new law modifies the amparo, a type of legal injunction introduced in the 19th century to protect citizens’ constitutional rights, which in recent years has been exploited by companies to frustrate regulators. Under new rules, concessionaires in industries including telecoms, mining and public transport will not be allowed to launch such injunctions.

Behind these reforms lies a “Pact for Mexico” struck between the PRI and the two main opposition parties in December. The Pact unites Mexico’s political parties against the unelected interests that have long defied them. As he signed the Pact on behalf of the left-wing Party of the Democratic Revolution (PRD), Jesús Zambrano declared that politicians were “outraged that de facto powers of all kinds have time and again broken governments of one party or another.”

The pact will come under strain in July, when there are local elections in 14 of Mexico’s 31 states, and a race for governor in Baja California. A poor showing for the opposition might prompt a more obstructive approach.

A bigger test of the Pact will come after the elections, when Mr Peña is due to publish his next proposal, a combined fiscal and energy reform designed to realise the enormous potential of Mexico’s oil and gas reserves. The country does not make the most of these: half its oil is in deep waters, of which Pemex, the state-owned oil and gas monopoly, has little experience. The state’s milking of Pemex’s profits has left it unable to invest in the necessary technology. To wean itself off oil revenue the government will have to raise taxes, probably applying value-added tax to food and medicine. The PRI changed its party constitution last month to allow this. But polls show overwhelming opposition to taxing those essentials.

How ambitious on energy?

It is not clear how ambitious Mr Peña plans to be. The most timid reform would merely give Pemex the sort of independence enjoyed by the central bank. A next step would be to turn it into a state-owned company capable of entering alliances with private firms, along the lines of Saudi Aramco. Even this will require a constitutional amendment. More radical still would be fully to open Mexico’s energy market to competition. This seems to be off the table for now: Mr Peña has said that he will not privatise Pemex. Even modest reforms are likely to provoke opposition, including within the PRI (whose senators include the leader of the oil workers’ union).

Another test is security. Mr Peña has helped to shift attention to Mexico’s perky economy rather than its gruesome violence. Barack Obama will get an earful of good news when he visits Mexico next month. The murder rate is about a quarter lower than at its peak in the summer of 2011; in February it registered a three-year low. But killings remain nearly twice as common as six years ago; extortion and kidnapping are an everyday menace.

Here Mr Peña seems at his weakest. He wants to reduce crime by creating more jobs, a worthy but long-term aim. A much-discussed plan to consolidate a ragbag of municipal police forces into their state counterparts may finally go ahead, now that the PRI controls the presidency as well as most of the states.

 Explore our interactive map of Mexico's drug traffic routes, "cartel" areas and crime-related homicides

Mr Peña’s proposal for a new “gendarmerie” of former soldiers, to control lawless bits of countryside, has come under criticism. It is unclear where the gendarmes’ responsibility would begin and where that of the existing Federal Police would end; nor is it obvious where the gendarmerie’s budget would come from. The force is expected to make its uncertain entrance towards the end of the year. But if he comes up with a clearer plan to reduce violence, and achieves an energy reform worthy of the name, Mr Peña will have had an impressive first year.