What do you think about creating a new JS file for upgrades and putting this code there?