how the script works