BlackBerry (bbry) broke even in the first quarter, topping expectations, and forecast a smaller-than-expected annual loss on Thursday, even as its revenue fell sharply.
Shares of the smartphone industry pioneer rose more than 4% in premarket trading.
The Canadian company, which has shifted focus from its once-dominant smartphones to the software that companies and governments need to manage their devices, said it expects to post an adjusted annual loss of around 15 cents per share.
Analysts had estimated a fiscal 2017 loss of 33 cents per share.
“They have not put figures behind some of their forecasts in quite some time, and hopefully that speaks to improved visibility into the business,” said Morningstar analyst Brian Colello.
Get Data Sheet, Fortune’s technology newsletter.
Excluding one-time items, the company posted profit of $14 million, or nil per share. Adjusted revenue totaled $424 million. Analysts, on average, expected a loss of 8 cents a share on revenue of $470.9 million, according to Thomson Reuters I/B/E/S.
The Waterloo, Ontario-based company reported a net loss of $670 million, or $1.28 cents a share, as it ran up costs to restructure operations and wrote down the value of some assets.
A year ago, it reported a profit of $68 million, or 10 cents a share.
BlackBerry said the net loss reflected a $501 million impairment charge, a $57 million goodwill impairment charge, and a $41 million writedown of inventory and other charges.
Software and licensing revenue was $166 million in the quarter ended May 31, just below the growth rate they have targeted for the full year.
Colello said a better selling smartphone could make the segment profitable.
“They have done a really good job of cutting operating expenses and shrinking the cost side of the business as revenue has fallen over the past couple years. The problem seems to be that hardware keeps falling faster,” he said.