Moody's Investors Service upgraded Netflix Inc.'s (NFLX) credit rating by one notch on Wednesday after predicting that the streaming giant’s growing subscriber base and gradual price increases will help it become cash flow positive in approximately five years.

The New York-based agency lifted its rating on Netflix from B1 to BA3, noting that the company's $6.5 billion of debt is still speculative but now slightly less at risk of default than before. Moody’s made the call after forecasting that continued subscriber growth will ensure Netflix's leverage ratio will become more manageable over the next two years, even as the streaming giant continues to invest vast amounts in original content.

In the report, Moody’s analyst Neil Begley estimated that Netflix’s debt-to-Ebitda ratio can drop from its current “high” level of 7.3 times to “comfortably under 5 times by 2020,” if it grows revenues in excess of 20% in each of the next three years, as expected. Begley expressed his confidence that Netflix can reach over 200 million subscribers by the end of 2021. Data from FactSet, reported on by Barron’s, estimates that the company’s user base stood at 123 million at the end of March. (See also: Netflix "Single Most Frustrating Stock to Cover," Say Analysts.)

A sharp rise in subscriber growth, Begley added, should widen Netflix’s profit margin, resulting in the big-spending company becoming "cash flow positive in approximately five years."

“We expect the steady subscriber growth, together with gradual price increases will outpace the increasing investment in content and the upfront working capital spending on self-produced and owned programming, resulting in steadily improving margins,” he said. “We believe that those margins will need to grow from the 7% range of 2017, to the low to mid 20% range to generate positive cash flows.”

Begley added in his report that the prospect of Moody’s upgrading Netflix’s rating again is limited because the company is likely to continue adding to its debt pile to fund its expansion. He expects that Netflix will add “as much as $15 billion of debt” in the next few years.

The analyst also warned that the Scotts Valley, California-based company could be downgraded if it fails to improve its profit margins and registers a decline in subscription numbers.