adjusted and refactored the alerts