diff --git a/quiz.install b/quiz.install
index d910607..2f027f0 100644
--- a/quiz.install
+++ b/quiz.install
@@ -179,6 +179,12 @@ function quiz_schema() {
         'not null' => TRUE,
         'default' => 0
       ),
+      'userpoints_tid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+      ),
       'time_left' => array(
         'type' => 'int',
         'size' => 'small',
@@ -789,6 +795,17 @@ function quiz_update_7407(&$sandbox) {
   return t('Added new auto update max score field to the quiz_node_relationship table');
 }
 
+/**
+ * Adding userpoints tid column
+ */
+function quiz_update_7409(&$sandbox) {
+  $table = 'quiz_node_properties';
+  $schema = drupal_get_schema_unprocessed('quiz', $table);
+  foreach (array('userpoints_tid') as $field) {
+    db_add_field($table, $field, $schema['fields'][$field]);
+  }
+  return t('Adding userpoints tid column to quiz_node_properties');
+}
 
 
 /**
diff --git a/quiz.module b/quiz.module
index 7afecd0..81dbe4e 100644
--- a/quiz.module
+++ b/quiz.module
@@ -730,6 +730,7 @@ function quiz_insert($node) {
       'display_feedback'            => $node->display_feedback,
       'tid'                         => (isset($node->tid) ? $node->tid : 0),
       'has_userpoints'              => isset($node->has_userpoints) ? $node->has_userpoints : 0,
+      'userpoints_tid'              => isset($node->userpoints_tid) ? $node->userpoints_tid : 0,
       'allow_skipping'              => $node->allow_skipping,
       'allow_resume'                => $node->allow_resume,
       'allow_jumping'               => $node->allow_jumping,
@@ -788,6 +789,7 @@ function quiz_update($node) {
         'display_feedback'            => $node->display_feedback,
         'number_of_random_questions'  => $node->number_of_random_questions,
         'has_userpoints'              => isset($node->has_userpoints) ? $node->has_userpoints : 0,
+        'userpoints_tid'              => isset($node->userpoints_tid) ? $node->userpoints_tid : 0,
         'allow_skipping'              => $node->allow_skipping,
         'allow_resume'                => $node->allow_resume,
         'allow_jumping'               => $node->allow_jumping,
@@ -932,6 +934,7 @@ function _quiz_get_node_defaults() {
     'quiz_always' => 1,
     'tid' => 0,
     'has_userpoints' => 0,
+    'userpoints_tid' => 0,
     'allow_skipping' => 1,
     'allow_resume' => 1,
     'allow_jumping' => 0,
@@ -1277,12 +1280,31 @@ function quiz_form(&$node, &$form_state) {
   }
 
   if (function_exists('userpoints_userpointsapi') && variable_get('quiz_has_userpoints', 1)) {
-    $form['has_userpoints'] = array(
+    $form['userpoints'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Userpoints'),
+      '#collapsible' => TRUE,
+      '#collapsed' => FALSE,
+      '#group' => 'additional_settings',
+    );
+    $form['userpoints']['has_userpoints'] = array(
       '#type' => 'checkbox',
       '#default_value' => (isset($node->has_userpoints) ? $node->has_userpoints : 1),
       '#title' => t('Enable UserPoints Module Integration'),
       '#description' => t('If checked, marks scored in this @quiz will be credited to userpoints. For each correct answer 1 point will be added to user\'s point.', array('@quiz' => QUIZ_NAME)),
     );
+    $form['userpoints']['userpoints_tid'] = array(
+      '#type' => 'select',
+      '#options' => _quiz_userpoints_type(),
+      '#title' => t('Userpoints Category'),
+      '#states' => array(
+        'visible' => array(
+          ':input[name=has_userpoints]' => array('checked' => TRUE),
+        ),
+      ),
+      '#default_value' => isset($node->userpoints_tid) ? $node->userpoints_tid : 0,
+      '#description' => t('Select the category to which user points to be added. To add new category see <a href="!url">admin/structure/taxonomy/userpoints</a>', array('!url' => url('admin/structure/taxonomy/userpoints'))),
+    );
   }
 
   // Set up the availability options.
@@ -1454,6 +1476,15 @@ function quiz_form(&$node, &$form_state) {
   return $form;
 }
 
+function _quiz_userpoints_type() {
+  $userpoints_terms = taxonomy_get_tree(userpoints_get_vid());
+  $userpoints_tids = array(0 => t('Select'));
+  foreach ($userpoints_terms as $userpoints_term) {
+    $userpoints_tids[$userpoints_term->tid] = str_repeat('-', $userpoints_term->depth) . $userpoints_term->name;
+  }
+  return $userpoints_tids;
+}
+
 /**
  * Implements hook_validate().
  */
@@ -2484,6 +2515,9 @@ function quiz_quiz_finished($quiz, $score, $session_data) {
       'tid' => $selected_tid,
       'uid' => $taker->uid,
     );
+    if ($quiz->userpoints_tid != 0) {
+      $params['tid'] = $quiz->userpoints_tid;
+    }
     userpoints_userpointsapi($params);
   }
 }
@@ -2520,6 +2554,9 @@ function quiz_quiz_scored($quiz, $score, $rid) {
       'description' => t('Attened @title @quiz on @time', $variables),
       'tid' => $selected_tid,
     );
+    if ($quiz->userpoints_tid != 0) {
+      $params['tid'] = $quiz->userpoints_tid;
+    }
     userpoints_userpointsapi($params);
   }
 }
