Improved control flow of script execution