Satellite radio company SirusXM has been in talks with executives from Pandora for the better part of a year now regarding a potential acquisition. Those plans fell through but in its place, SiriusXM has agreed to invest $480 million in Pandora, giving it a 19% stake in the streaming music company.

Pandora CEO Tim Westergren says the influx of money will give his company “the flexibility we need to attack what is becoming a larger and larger opportunity as digital music enters a new golden age."

Pandora was a pioneer in the streaming music world with its radio station based service that tailors to the user’s taste in music the more you use it. But it’s been struggling to compete in recent years with services like Spotify and Apple Music that offer on-demand streaming music. The company launched its own Pandora Premium on-demand music service back in March to better compete with them.

Pandora's active listeners were 76.7 million at the end of the first quarter of 2017, down from 79.4 million a year ago. The company makes most of its money from advertising around free listeners.

Under the terms of the deal Sirius will end up with three of nine Pandora board seats, including the chairman slot. Sirius isn’t allowed buying any more Pandora shares for another 18 months, and after than it can’t acquire more than 31.5% of the company without the approval of Pandora’s board.

In addition to the SiriusXM deal, Pandora has offloaded Ticketfly to Eventbrite for $200 million. The company had acquired the ticketing service in October 2015 for $450 million, in an effort to develop alternative revenue streams around events and ticket sales. Pandora will enter into a distribution partnership with Eventbrite as part of that deal.