restructuring the scripts