alert refactor