overhaul to script structure