refactor the alert manager