Detailed explanation of script