final version of the script