  $('button.ui-button').on('click', function(){ 
    if (buttonState == 1.0 && linkState == 1.0){
      core.endEpisode(1.0, true);
    } else {
      core.endEpisode(-1.0);
    }
  })

  // generate query text in the UI
  d3.select('#query').html('Click on the link "' + correctText + '", click on the "' + correct_text + '" button, and then close the dialog box by clicking the "x".');
  // d3.select('#query').html('Close the dialog box by clicking the "x", after clicking on the link "' + correctText + '" an