Enhanced master script generation