major refactoring of AlertManager