If statement for last alert and alert added for if statement.