Move the logic into the script