Refactored some methods in the AlertLayer class