added the script and var logic