final version of script