Actually got the script working