redesigned logic using state machine, allows muting alarm with button