restructured the script