Migrating New function to a global script

repairing damage from mechanic change, trying to design a modular system
to save time later