added download of raw JSON file using onDownloadRequested function; caught a few JS exceptions