refactor the alert module