updated tested script
updated working script