Updated deprecated script with its latest update from pastebin