updated with change to my logic that got the script working
script now working