Added comment and if statement to JS