DoorDash has reached an agreement with Square to purchase on-demand food delivery and catering business Caviar. DoorDash has agreed to pay Square $410 million in cash and preferred DoorDash stock.

Square bought Caviar about five years ago in a deal worth about $90 million. Now, Caviar has found a new home with DoorDash, the on-demand delivery startup that had been under fire for months regarding how it pays its delivery workers. DoorDash is finally starting to do right by its workers by saying it will no longer subsidize wages with tips, though, that has not gone into effect just yet. However, Sage Wilson of workers’ rights organization Working Washington said doing right by workers would also entail backpay.

“Today’s announcement is another important step forward on our mission to empower local economies,” DoorDash CEO Tony Xu (pictured above) said in a statement. “We have long-admired Caviar, which has a coveted brand, an exceptional portfolio of premium restaurants and leading technology. The acquisition further enhances the breadth of our merchant selection, enabling us to offer customers even more choice when they order through DoorDash. We look forward to welcoming the Caviar team to DoorDash and expanding our partnership with Square in the future.”

We’re thrilled to welcome Caviar to the family, and to work together towards our shared vision of empowering local economies. https://t.co/MGCGYdVhvT — DoorDash (@DoorDash) August 1, 2019

With Caviar joining DoorDash, Square’s Caviar lead, Gokul Rajaram, along with all the other Caviar employees, will join DoorDash once the acquisition closes. The deal is expected to close sometime this year.

“Caviar has built a trusted brand with customers and many of the best restaurants,” Rajaram said in a statement. “DoorDash has national scale, complementary restaurant selection, a tremendous logistics platform, and a team that shares our passion and commitment to better serve restaurants, couriers, and customers. I’m incredibly excited to be joining, with the rest of the Caviar team, to help build the future of local commerce.”

For Square, this deal provides the company with an opportunity to focus more on its products for businesses and individuals, Square CEO Jack Dorsey said.

“We are increasing our focus on and investment in our two large, growing ecosystems — one for businesses and one for individuals,” Dorsey said. “This transaction furthers that effort, and we believe partnering with DoorDash provides valuable and strategic opportunities for Square.”

It’s worth noting this isn’t the first time Square has tried to rid itself of Caviar. In 2016, Bloomberg reported Square was wanting to sell Caviar for $100 million but couldn’t find a buyer. At the time, Square was reportedly in talks with Uber, Grubhub and Yelp due to Caviar’s excessive losses. Square, however, does not break out specific Caviar earnings.

Meanwhile, Square just reported its Q2 2019 earnings with net revenues of $1.17 billion (44% y/o/y growth), adjusted revenues of $563 million (46% y/o/y growth) and a net loss of $7 million. In Square’s letter to shareholders, the company described how there will now be more clarity regarding how the company operates.

“Furthermore, DoorDash is already integrated with Square for Restaurants, which streamlines the acceptance of online and in-person orders for merchants, and in the second quarter Cash Boost partnered with DoorDash to provide instant rewards when customers use their Cash Card at DoorDash. We believe continuing this partnership provides valuable and strategic opportunities for Square.”

As Dorsey said on today’s earnings call, “as DoorDash succeeds, we succeed.”

The big players in the on-demand food delivery space are now DoorDash/Caviar, Postmates, UberEats and Grubhub/Seamless. In May, DoorDash raised a $400 million round valuing it at $12.6 billion. Postmates, easily now one of DoorDash’s prime competitors, is currently worth about $1.85 billion and confidentially filed to go public earlier this year. Though, that IPO has yet to happen.