Javascript cleanup and thumbnail hyperlink bypass