optimize selector code for alert message