This should be all you need for now:
Assuming it works, I’d still recommend you look at what you had before and figure out for yourself why it didn’t work. You’ll need to upgrade/replace this in the future as you add more complex logic, and you’ll need to understand what it does to do so.