updated script from githubuser