Added if statement to script.js