Script updates

final version of the script