Beijing: Baidu Inc’s quarterly results beat analysts’ estimates as it kept a lid on expenses, while search advertising stabilized after Chinese government restrictions squeezed earnings in 2016.

China’s largest search engine reported a better-than-projected 83% leap in net income after both general and traffic acquisition costs shrank.

On Thursday, the company also said it was considering a change in its operating structure to allow its rapidly growing finance unit—a source of concern to Moody’s Investors Service, among others—to let it operate more independently.

Baidu forecast revenue for the third quarter of 23.1 billion yuan ($3.4 billion) to 23.8 billion yuan, compared with the 23 billion yuan average of analysts’ estimates compiled by Bloomberg. It reported a 14% rise in revenue to 20.9 billion yuan in the June quarter versus projections for 20.7 billion yuan. And net income for the period was 4.4 billion yuan, sharply outpacing estimates of 2.9 billion yuan.

Its shares jumped 7.5% in extended trading. Baidu has cut back on costly subsidies for its struggling food delivery business, part of an expansion into so-called online-to-offline (O2O) or on-demand services. But the company is expected to keep building its library of online video and music and accelerate research into artificial intelligence to stay ahead of the pack.

“Marketing spending for O2O has come down quite visibly," said Kirk Boodry, an analyst with New Street Research. “While the numbers for the quarter looked good, we think the costs for their content this year are probably going to be back-loaded."

Baidu is investing heavily in its open-source Apollo driverless cars program and other artificial intelligence (AI) research. It’s counting on those projects to offset slowing growth in its core business of selling Internet ads. The company has been slashing costs in its group buying and food delivery businesses after previous investments failed to give them a dominant position.

“Baidu’s Apollo plan will reduce the R&D cost of the auto driving industry," Connie Gu, an analyst at Bocom International Holdings, said in a report before the results. “A more detailed schedule of fully autonomous driving capabilities on highways and urban roads helped boost investors’ confidence in Baidu’s AI services."

Online marketing revenue rose 5.6% though the number of customers was down more than 20% from the same quarter of 2016. Baidu’s ad business was hit hard in 2016 after the government imposed harsher regulations and changed the tax status of a key product.

The entire customer base had to re-register with stricter conditions and many chose to switch platforms, reducing the pool of advertisers. As a result, the company reported its first annual earnings decline since its 2005 initial public offering.

The company was also placed on review for a potential downgrade by Fitch Ratings and Moody’s over its push into the riskier business of Internet loans. Baidu has been lending to students and others using AI to determine credit risks. Both ratings companies said the risks of such businesses were very different from its traditional strength as a search engine.

Baidu’s newsfeed product, which uses algorithms and a person’s behaviour to tailor content, has driven an increase in the amount of time spent using its services, according to Karen Chan, an analyst at Jefferies Group.

Ads related to this new service may reach 5.8 billion yuan, or about 7% of total sales, in fiscal year 2017, Chan estimated in a report before the earnings. The company’s video-streaming service iQiyi has also become a substantial source of cash.

“The growth in the news feed is pretty substantial but that segment of the market has been growing quite strongly. It’s still a very competitive market," Boodry said. Bloomberg