code refactoring - related to alert.