script restructure