refactoring style of showing alerts