script.js edited to handle single tag selections