Restructure of scripts