move the logic into the script