added if statement and alert