added an if statement and comments.