function setCountAndTopicList() {
  var topicLists = document.getElementsByClassName('checkBox');

  // Retrieves topics list from localStorage.
  var topics = JSON.parse(window.localStorage.getItem('topics'));

  // Runs if retrieved topic list from local storage contains topics.
  if (topics) {
    for (var x = 0, topicList; topicList = topicLists[x]; x++) {

      // Saves whether checkbox is checked or not.
      var isPresent = false;
      for (var y = 0; y < topics.length; y++) {
        if (topics[y] == topicList.value) {
          topicList.checked = true;
          isPresent = true;
          checkCount++;
          break;
        }
      }
      if (!isPresent) {
        topicList.checked = false;
      }
    }
  }

  // Retrieves list of custom topics from localstorage(if any) and shows it
  // in option page.
  var keywords = JSON.parse(window.localStorage.getItem('keywords'));
  if (keywords) {

    // Template to store custom topics in a table.
    var template = [];
    var title = chrome.i18n.getMessage('deleteTitle');
    for (var i = 0; i < keywords.length; i++) {
      checkCount++;

      template.push('<tr style = "height: 22px;">');
      template.push('<td id = "keyword_value" class = "cusTopicsClass">');
      template.push('<textarea class="noborder" readonly>');
      template.push(keywords[i]);
      template.push('</textarea>');
      template.push('<td class = "suppr" onclick = "delCusTopic(this)" ');
        template.push('title="');
        template.push(title);
        template.push('">');
      template.push('</td>');
      template.push('</tr>');
    }
    $('custom_topics').innerHTML = template.join('');
    if (keywords.length == MAX_CUS_TOPICS) {
      $('submit_button').disabled = true;
      $('newKeyword').readOnly = 'readonly';
    }
  }
  // Check all checkboxes(default settings) if no custom topic list and
  // checkbox topic list from local storage is found.
  if (!keywords && !topics) {
    for (var x = 0, topicList; topicList = topicLists[x]; x++) {
      topicList.checked = true;
      checkCount++;
    }
  }

  // Retrieves saved value of number of stories.
  var count = window.localStorage.getItem('count');

  // Sets number of stories in dropdown.
  if (count) {
    $('storyCount').value = count;
  }
}
Sets topic list and number of stories retrieved from localstorage(if any)
otherwise sets to default.