added the if statement, and set up the alert message.