maybe move the relevant part of legacy_license here too?