ammended logic for alarms