Overhaul the script structure