updated js file based on instructor feedback