defaulted to document.title if nothing is selected and removed unecessary check