--- quiz_progress/css/quiz_progress.css
+++ quiz_progress/css/quiz_progress.css
@@ -1,7 +1,5 @@
 .quiz-progress-item-list {
-  height: 300px;
-  overflow: auto;
-  padding: 4px;
+  height: auto;
 }
 
 .quiz-progress-item-list li {
@@ -15,9 +13,7 @@
 
 .quiz-progress-item-table tr td.skipped a,
 .quiz-progress-item-list li.skipped a {
-  /*background: url("../img/skipped.png") no-repeat scroll right top transparent;*/
   color: #A30000;
-  padding-right: 2em;
 }
 
 #tooltip {
@@ -30,3 +26,7 @@
   color: #FFF;
 }
 #tooltip h3, #tooltip div { margin: 0; }
+
+table.quiz-progress-item-table td {
+    text-align:center;
+}

--- quiz_progress/js/quiz_progress.js
+++ quiz_progress/js/quiz_progress.js
@@ -1,31 +1,17 @@
-Drupal.behaviors.quizProgress = function() {
-  // tooltip
-  $('.quiz-progress-block-wrapper a').tooltip({ showURL: false });
+(function ($) {
+  Drupal.behaviors.quizProgress = {
+    attach: function (context, settings) {
+      $('.quiz-progress-block-wrapper a').tooltip({ showURL: false });
   
-  $('#block-quiz_progress-0 a.quiz-progress').click(function() {
-    var element_id = $(this).attr('id');
-    var quiz_jump_id = element_id.replace('quiz-progress-id-', '');
-    if (quiz_jump_id > 0) {
-      $("#quiz-jumper").val(quiz_jump_id);
-      $("#quiz-jumper").change();      
-    }
-  })
-
-  
-  if (Drupal && Drupal.settings && Drupal.settings.quiz_progress && Drupal.settings.quiz_progress.show_kipped == 1) {    
-    $("#quiz-question-answering-form #edit-submit").click(function() {
-      var jump_qid = $("#quiz-jumper").val();
-      if ($("#quiz-progress-id-" + jump_qid + '"').length > 0) {
-        var element_id = $("#quiz-progress-id-" + jump_qid + '"').parent().next().children().attr("id");
+      $('#block-quiz-progress-quiz-progress-block a.quiz-progress').click(function() {
+        var element_id = $(this).attr('id');
         var quiz_jump_id = element_id.replace('quiz-progress-id-', '');
         if (quiz_jump_id > 0) {
           $("#quiz-jumper").val(quiz_jump_id);
-          $("#quiz-jumper").change();
+          $("#quiz-jumper").change();      
         }
-      }
-    })
-  }  
-};
-
-
+      }); 
+    }
+  };
+})(jQuery);
 
--- quiz_progress/quiz_progress.admin.inc
+++ quiz_progress/quiz_progress.admin.inc
@@ -1,5 +1,15 @@
 <?php
-
+/**
+ * @file
+ * Quiz_progress admin.inc file.
+ *
+ * This file includes the configuration form for quiz progress module
+ *   - Using this form we can set either question title or number to be displayed in the quiz progress block
+ *   - One can set text & background colors for questions in the block depending on their status answered, skipped or queued
+ */
+/**
+ * Quiz Progress configuration form
+ */
 function quiz_progress_config_form() {
   $form['quiz_progress_output_style'] = array(
     '#title' => t('Output style'),
@@ -35,14 +45,14 @@ function quiz_progress_config_form() {
   $form['quiz_progress_output_color']['quiz_progress_output_bg_color_answered'] = array(
     '#title' => t('Answered questions background color'),
     '#type' => 'textfield',
-    '#default_value' => variable_get('quiz_progress_output_bg_color_answered', ''),
+    '#default_value' => variable_get('quiz_progress_output_bg_color_answered', '#009900'),
     '#maxlength' => 7,
     '#size' => 10,
   );
   $form['quiz_progress_output_color']['quiz_progress_output_text_color_answered'] = array(
     '#title' => t('Answered questions text color'),
     '#type' => 'textfield',
-    '#default_value' => variable_get('quiz_progress_output_text_color_answered', '#33A333'),
+    '#default_value' => variable_get('quiz_progress_output_text_color_answered', '#001F00'),
     '#maxlength' => 7,
     '#size' => 10,
   );
@@ -50,14 +60,14 @@ function quiz_progress_config_form() {
   $form['quiz_progress_output_color']['quiz_progress_output_bg_color_skipped'] = array(
     '#title' => t('Skipped questions background color'),
     '#type' => 'textfield',
-    '#default_value' => variable_get('quiz_progress_output_bg_color_skipped', ''),
+    '#default_value' => variable_get('quiz_progress_output_bg_color_skipped', '#FF0000'),
     '#maxlength' => 7,
     '#size' => 10,
   );
   $form['quiz_progress_output_color']['quiz_progress_output_text_color_skipped'] = array(
     '#title' => t('Skipped questions text color'),
     '#type' => 'textfield',
-    '#default_value' => variable_get('quiz_progress_output_text_color_skipped', '#A30000'),
+    '#default_value' => variable_get('quiz_progress_output_text_color_skipped', '#800000'),
     '#maxlength' => 7,
     '#size' => 10,
   );
@@ -65,14 +75,14 @@ function quiz_progress_config_form() {
   $form['quiz_progress_output_color']['quiz_progress_output_bg_color_queued'] = array(
     '#title' => t('Upcoming questions Background color'),
     '#type' => 'textfield',
-    '#default_value' => variable_get('quiz_progress_output_bg_color_queued', ''),
+    '#default_value' => variable_get('quiz_progress_output_bg_color_queued', '#FFA500'),
     '#maxlength' => 7,
     '#size' => 10,
   );
   $form['quiz_progress_output_color']['quiz_progress_output_text_color_queued'] = array(
-    '#title' => t('Upcoming questions Background color'),
+    '#title' => t('Upcoming questions text color'),
     '#type' => 'textfield',
-    '#default_value' => variable_get('quiz_progress_output_text_color_queued', '#027AC6'),
+    '#default_value' => variable_get('quiz_progress_output_text_color_queued', '#804C00'),
     '#maxlength' => 7,
     '#size' => 10,
   );

--- quiz_progress/quiz_progress.info
+++ quiz_progress/quiz_progress.info
@@ -1,8 +1,14 @@
 name = Quiz Progress
-package = Quiz Addon
 description = Implements a block to switch between the questions.
+core = 7.x
+package = Quiz Addon
 dependencies[] = quiz
-core = 6.x
+configure = admin/quiz/settings/quiz_progress
+
+; Always available CSS
+stylesheets[all][] = css/quiz_progress.css
+
+files[] = quiz_progress.admin.inc
 
 ; Information added by drupal.org packaging script on 2011-09-19
 version = "7.x-1.0-beta1"

--- quiz_progress/quiz_progress.module
+++ quiz_progress/quiz_progress.module
@@ -11,7 +11,7 @@ function quiz_progress_menu() {
   $items['admin/quiz/settings/quiz_progress'] = array(
     'title' => '@quiz progress configuration',
     'title arguments' => array('@quiz' => QUIZ_NAME),
-    'description' => t('Configure @quiz settings.', array('@quiz' => QUIZ_NAME)),
+    'description' => 'Configure @quiz settings.', array('@quiz' => QUIZ_NAME),
     'page callback' => 'drupal_get_form',
     'page arguments' => array('quiz_progress_config_form'),
     'access arguments' => array('administer quiz configuration'),
@@ -29,6 +29,45 @@ function quiz_progress_menu() {
   return $items;
 }
 
+/**
+ * Implementation of hook_perm()
+ */
+function quiz_progress_permission() {
+  return array(
+    'access_quiz_progress' => array(
+      'title' => t('Access quiz progress'),
+      'description' => t('Allows to access quiz progress block'),
+    ),
+  );
+}
+
+/**
+ * Implements hook_theme().
+ */
+function quiz_progress_theme() {
+  return array(
+    'quiz_progress_question_block' => array(
+    'variables' => array('quiz' => NULL, 'questions' => NULL),
+    )
+  );
+}
+
+/**
+ * Implementation of hook_help()
+ */
+function quiz_progress_help($path, $arg) {
+  switch ($path) {
+    case 'admin/help#quiz_progress':
+      return '' . '<h3>' . t('About') . '</h3>' . '<p>' . t("The Quiz Progress module implements a block to switch between the questions.") . '<p>';
+  }
+}
+
+/**
+ * Function to set Session variable for showing skipped questions
+ * 
+ * @param $quiz
+ *   -quiz: quiz object
+ */
 function _quiz_progress_set_filter($quiz) {
   if (!isset($_SESSION['quiz_progress_show_kipped'])) {
     $_SESSION['quiz_progress_show_kipped'] = TRUE;
@@ -39,49 +78,82 @@ function _quiz_progress_set_filter($quiz
 }
 
 /**
- * Implementation of hook_perm()
+ * Implementation of hook_block_info()
  */
-function quiz_progress_perm() {
-  return array('access quiz progress');
+function quiz_progress_block_info() {
+  $blocks['quiz_progress_block'] = array(
+    'info' => t('Quiz Progress Block'),
+    'cache' => DRUPAL_NO_CACHE,
+  );
+
+  return $blocks;
 }
 
 /**
- * Implementation of hook_block()
+ * Implementation of hook_block_view()
  */
-function quiz_progress_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
-    $block[0]['info'] = t('@quiz progress block', array('@quiz' => QUIZ_NAME));
-    return $block;
-  }
-  else if ($op == 'view') {
-    if (user_access('access quiz progress')) {
-      $quiz_nid = arg(1);
-      $quiz = node_load($quiz_nid);
-      if (quiz_progress_block_access($quiz)) {
-        $block['content'] = quiz_progress_block_content($quiz);
-        $block['subject'] = check_plain($quiz->title);
-        return $block;
+function quiz_progress_block_view($delta = '') {
+  $block = array();
+  switch ($delta) {
+    case 'quiz_progress_block':
+      if (user_access('access_quiz_progress')) {
+        $quiz_nid = arg(1);
+        $quiz = node_load($quiz_nid);
+        if (quiz_progress_block_access($quiz)) {
+          $questions = quiz_progress_block_content_load($quiz);
+          $block['content'] = array( 
+            '#theme' => 'quiz_progress_question_block', 
+            '#quiz' => $quiz,
+            '#questions' => $questions,
+          );
+          $block['subject'] = check_plain($quiz->title);
+        }
       }
-    }
+      break;
   }
+  return $block;
 }
 
-function quiz_progress_block_access($quiz) {
-  return arg(0) == 'node' &&
-    arg(2) == 'take' &&
-    is_object($quiz) &&
-    $quiz-> allow_jumping &&
-    $_SESSION['quiz_'. $quiz->nid]['result_id'] > 0;
+/**
+ * Function to load module css, js files
+ * and fetch questions in the quiz.
+ * 
+ * @param $quiz
+ */
+function quiz_progress_block_content_load($quiz) {
+  $questions = NULL;
+  _quiz_progress_block_load_styles();
+  $questions = array_merge($_SESSION['quiz_' . $quiz->nid]['previous_quiz_questions'] , $_SESSION['quiz_' . $quiz->nid]['quiz_questions']);
+  return $questions;
 }
 
-function quiz_progress_block_content($quiz) {
-  _quiz_progress_block_load_styles();
-  $questions = array_merge($_SESSION['quiz_'. $quiz->nid]['previous_quiz_questions'] , $_SESSION['quiz_'. $quiz->nid]['quiz_questions']);  
-  $output = quiz_progress_block_skipped_filter($quiz);
-  $output .= quiz_progress_block_get_styled_output($quiz, $questions);
-  return $output;
+/**
+ * Function to decide availability of quiz progress block
+ *
+ * @param $quiz
+ * 
+ * @return boolean value
+ *   -true or false
+ */
+function quiz_progress_block_access($quiz) {
+  if (arg(0) == 'node' &&  arg(2) == 'take' &&
+    is_object($quiz) && $quiz->allow_jumping &&
+    isset($_SESSION['quiz_' . $quiz->nid]['result_id'])) {
+    if ($_SESSION['quiz_' . $quiz->nid]['result_id'] > 0) {
+      return TRUE;
+    }
+    return FALSE;
+  }
 }
 
+/**
+ * Function to build links to be displayed in quiz progress block
+ * e.g. Show all, Show only skipped questions
+ *
+ * @param quiz object
+ * @return link 
+ *   e.g. Show all, Show only skipped questions
+ */
 function quiz_progress_block_skipped_filter($quiz) {
   if (isset($_SESSION['quiz_progress_show_kipped']) &&  $_SESSION['quiz_progress_show_kipped']) {
     $text = t('Show all');
@@ -92,6 +164,16 @@ function quiz_progress_block_skipped_fil
   return l($text, "node/{$quiz->nid}/quiz_progress_set_filter");
 }
 
+/**
+ * Function to build Question links to be displayed in quiz progress block
+ * 
+ * @param
+ *   status - status of the question e.g. skipped, answered, queued
+ *   question - question details
+ *   question_title - Text to be displayed on mouse hover
+ * 
+ * @return array of attributes of a question 
+ */
 function quiz_progress_get_link_options($status, $question, $question_title) {
   $color = variable_get('quiz_progress_output_text_color_' . $status, '');
   return array(
@@ -106,14 +188,26 @@ function quiz_progress_get_link_options(
   );
 }
 
-function quiz_progress_block_get_styled_output($quiz, $questions) {
+/**
+ * Returns HTML for the content of quiz progress block
+ * 
+ * @param $variables
+ *   An associative array containing:
+ *   - quiz: quiz object
+ *   - questions: - questions in the quiz
+ */
+function theme_quiz_progress_question_block($variables) {
+  $quiz = $variables['quiz'];
+  $questions = $variables['questions'];
+  _quiz_progress_block_load_styles();
+
   if (isset($_SESSION['quiz_progress_show_kipped']) &&  $_SESSION['quiz_progress_show_kipped']) {
     $items = array();
     drupal_add_js(array('quiz_progress' => array('show_kipped' => 1)), 'setting');
     $title_length = variable_get('quiz_progress_title_style_length', 32);
     foreach ($questions as $question) {
       if (empty($question)) {
-       continue;
+        continue;
       }
       $status = _quiz_progress_get_question_status($quiz, $question);
       if ($status != 'skipped') {
@@ -127,66 +221,77 @@ function quiz_progress_block_get_styled_
     if (empty($items)) {
       return '<p>' . t('You have no skipped questions') . '</p>';
     }
-    return '<div class="quiz-progress-block-wrapper">' .
-      theme('item_list', $items, t('Questions'), 'ol', array('class' => 'quiz-progress-item-list')) .
-      '</div>';
+    
+    $output = quiz_progress_block_skipped_filter($quiz);
+    $output .= '<div class="quiz-progress-block-wrapper">';
+    $output .= theme('item_list', array('items' => $items, 'title' => t('Questions'), 'type' => 'ol', 'attributes' => array('class' => 'quiz-progress-item-list'))) . '</div>';
+    return $output;
   }
+
   $output_style = variable_get('quiz_progress_output_style', 'number');
+
   if ($output_style == 'number') {
     $rows = array();
     $row = 0;
     $col_size = variable_get('quiz_progress_number_style_col_size', 4);
     foreach ($questions as $question) {
       if (empty($question)) {
-       continue;
-      }      
+        continue;
+      }
       $question_title = _quiz_progress_get_question_title($question);
       $status = _quiz_progress_get_question_status($quiz, $question);
       $bg_color = variable_get('quiz_progress_output_bg_color_' . $status, '');
       $options = quiz_progress_get_link_options($status, $question, $question_title);
       $rows[$row][$question['number']] = array(
-        'data' => l($question['number'], '', $options),
-        'class' => $status,
-        'style' => "background-color: $bg_color;"
-      );
+                                               'data' => l($question['number'], '', $options),
+                                               'class' => $status,
+                                               'style' => "background-color: $bg_color;"
+                                               );
       $row = $question['number'] % $col_size != 0 ? $row : $row + 1;
     }
-    // TODO : Use hook_theme to allow other module to override the output.
-    return  '<div class="quiz-progress-block-wrapper">' .
-      theme('table', array(), $rows, array('class' => 'quiz-progress-item-table')) .
+
+    $output = quiz_progress_block_skipped_filter($quiz);
+    $output .= '<div class="quiz-progress-block-wrapper">' .
+      theme('table', array('rows' => $rows, 'attributes' => array('class' => 'quiz-progress-item-table'))) .
       '</div>';
+    return $output;
+
   }
-  else if ($output_style == 'title') {
+  elseif ($output_style == 'title') {
     $items = array();
     $title_length = variable_get('quiz_progress_title_style_length', 32);
     foreach ($questions as $question) {
       if (empty($question)) {
-       continue;
+        continue;
       }
       $question_title = _quiz_progress_get_question_title($question);
       $status = _quiz_progress_get_question_status($quiz, $question);
       $options = quiz_progress_get_link_options($status, $question, $question_title);
       $bg_color = variable_get('quiz_progress_output_bg_color_' . $status, '');
-      $items[] = array(
-        'data' => l(drupal_substr($question_title, 0, $title_length), '', $options),
-        'class' => $status,
-        'style' => "background-color: $bg_color;"
-      );
+      $items[$question['nid']] = l(drupal_substr($question_title, 0, $title_length), '', $options);
     }
-    return '<div class="quiz-progress-block-wrapper">' .
-      theme('item_list', $items, t('Questions'), 'ol', array('class' => 'quiz-progress-item-list')) .
-      '</div>';
+    $output = quiz_progress_block_skipped_filter($quiz);
+    $output .= '<div class="quiz-progress-block-wrapper">';
+    $output .= theme('item_list', array('items' => $items, 'title' => t('Questions'), 'type' => 'ol', 'attributes' => array('class' => 'quiz-progress-item-list'))) . '</div>';
+    return $output;
   }
   return '';
 }
 
+/**
+ * Function to retrun question status
+ * 
+ * @param $quiz, $question
+ *   -quiz: quiz object
+ *   -question: array of question details e.g. nid, vid, etc.
+ * 
+ * @return status of question queued, skipped or answered
+ */
 function _quiz_progress_get_question_status($quiz, $question) {
-  $rid = $_SESSION['quiz_'. $quiz->nid]['result_id'];
-  $query = db_query('SELECT is_correct, is_skipped FROM {quiz_node_results_answers}
-    WHERE result_id = %d AND question_nid = %d AND question_vid = %d',
-    $rid, $question['nid'], $question['vid']
-  );
-  $answer = db_fetch_object($query);
+  $rid = $_SESSION['quiz_' . $quiz->nid]['result_id'];
+  $answer = db_query('SELECT is_correct, is_skipped FROM {quiz_node_results_answers}
+    WHERE result_id = :rid AND question_nid = :nid AND question_vid = :vid',
+    array(':rid' => $rid, ':nid' => $question['nid'], ':vid' => $question['vid']))->fetch();
   if (empty($answer)) {
     return 'queued';
   }
@@ -200,18 +305,29 @@ function _quiz_progress_get_question_sta
   }
 }
 
+/**
+ * Function to fetch the question title
+ * 
+ * @param $question
+ *   -question: details of question node. e.g. nid, vid
+ *  
+ * @return $question_title
+ */
 function _quiz_progress_get_question_title($question) {
-  $query = db_query('SELECT title FROM {node_revisions}
-    WHERE nid = %d AND vid = %d',
-    $question['nid'], $question['vid']);
-  $quiz_title = db_result($query);
-  return (bool) $quiz_title ? check_plain($quiz_title) : '';
+  $question_title = db_query('SELECT title FROM {node_revision}
+    WHERE nid = :nid AND vid = :vid',
+    array( ':nid' => $question['nid'], ':vid' => $question['vid']))->fetch();
+  $question_title = isset($question_title->title) ? $question_title->title : '';
+  return $question_title;
 }
 
+/**
+ * Function to load quiz module css and js files
+ */
 function _quiz_progress_block_load_styles() {
   $module_path = drupal_get_path('module', 'quiz_progress');
-  drupal_add_css($module_path . '/css/quiz_progress.css', 'module');
-  drupal_add_js($module_path . '/js/jquery.dimensions.js', 'module');
-  drupal_add_js($module_path . '/js/jquery.tooltip.js', 'module');
-  drupal_add_js($module_path . '/js/quiz_progress.js', 'module');
+  drupal_add_css($module_path . '/css/quiz_progress.css');
+  drupal_add_js($module_path . '/js/jquery.dimensions.js');
+  drupal_add_js($module_path . '/js/jquery.tooltip.js');
+  drupal_add_js($module_path . '/js/quiz_progress.js');
 }
