Added the if else statement and added the alert.