updated script structure