refactor alert