The back and forth legal battle between the Beastie Boys and toy company GoldieBlox has come to an end. The remaining members of the hip-hop group have settled with the Californian company that used the Beastie’s song “Girls” in a parody video ad that went viral; GoldieBlox has agreed to issue an apology and pay a sum to Beastie-approved charities.

The whole battle began when GoldieBlox, which specializes in engineering toys for girls, used the song in an ad, though they tweaked the lyrics to fit their girl-empowered brand. (The original lyrics — “Girls to do the dishes / Girls to clean up my room / Girls to do the laundry / Girls and in the bathroom” — were replaced with more girl-friendly lyrics — “Girls to build a spaceship / Girls to code the new app / Girls to grow up knowing / That they can engineer that.”)

When the band members Michael Diamond and Adam Horowitz objected to the company’s use of their song, GoldieBlox filed a pre-emptive lawsuit against the Beasties, saying that the company had created a parody of the song, which constituted fair use.

The Beasties then wrote an open letter to the company, which outlined their objections to the video:

As creative as it is, make no mistake, your video is an advertisement that is designed to sell a product, and long ago, we made a conscious decision not to permit our music and/or name to be used in product ads.

So the Beasties, who have a blanket ban on using their work in advertisements, counter-sued the company. The Beasties’ suit stated that video’s use of the song didn’t constitute fair use as the ad used “the Beastie Boys’ musical composition ‘Girls’ with lyrics modified to become a ‘jingle’ to sell GoldieBlox’s products.” (The Beasties’ suit also noted that their original lyrics were “sarcastic.”) What’s more, late Beastie Boy Adam Yauch’s will included a stipulation that stated “in no event may my image or name or any music or any artistic property created by me be used for advertising purposes,” which only bolstered the band’s complaint.

Yet, at last, the whole issue seems to have been resolved. A spokesman for the the toy makers told Rolling Stone that the “settlement includes (a) the issuance of an apology by GoldieBlox, which will be posted on GoldieBlox’s website, and (b) a payment by GoldieBlox, based on a percentage of its revenues, to one or more charities selected by Beastie Boys that support science, technology, engineering and mathematics education for girls.” Chalk it up as a win for both girls and “Girls.”

Contact us at letters@time.com.