The logic now works and buttons trigger the alerts.