diff --git a/sites/all/modules/userpoints_history/userpoints_history.admin.inc b/sites/all/modules/userpoints_history/userpoints_history.admin.inc
index 3931b5e..9e0f475 100644
--- a/sites/all/modules/userpoints_history/userpoints_history.admin.inc
+++ b/sites/all/modules/userpoints_history/userpoints_history.admin.inc
@@ -25,6 +25,12 @@ function userpoints_history_settings_form($form_state = NULL) {
     '#size'           => 8,
     '#default_value'  => variable_get('userpoints_history_imgsize', '400x300'),
   );
+  $form['userpoints_history_showtab'] = array(
+    '#type'           => 'checkbox',
+    '#title'          => t('Show tab on user page'),
+    '#description'    => t('Expose the graphs as a tab on the user page.'),
+    '#default_value'  => variable_get('userpoints_history_showtab', '1'),
+  );
   return $form;
 }
 
diff --git a/sites/all/modules/userpoints_history/userpoints_history.module b/sites/all/modules/userpoints_history/userpoints_history.module
index 66a047a..584455a 100644
--- a/sites/all/modules/userpoints_history/userpoints_history.module
+++ b/sites/all/modules/userpoints_history/userpoints_history.module
@@ -43,7 +43,6 @@ function userpoints_history_menu() {
     'access callback'   => 'userpoints_history_access_history',
     'access arguments'  => array(1),
     'type'              => MENU_LOCAL_TASK,
-    'file'              => 'userpoints_history.pages.inc',
   );
 /*
  * Removed for now in favor of hook_form_alter to userpoints_admin_settings
@@ -92,6 +91,8 @@ function userpoints_history_form_alter(&$form, $form_state, $form_id) {
  */
 function userpoints_history_access_history($uid) {
 global $user;
+  if (variable_get('userpoints_history_showtab', '1') == 0)
+    return FALSE;
   // Nothing to show, skip. Avoid showing the tab on users without point assignement.
   if (!_userpoints_user_exists($uid)) 
     return FALSE;
@@ -105,3 +106,174 @@ global $user;
   return FALSE;
 }
 
+/**
+ * Implementation of hook_block()
+ */
+function userpoints_history_block($op = 'list', $delta = 0, $edit = array()) {
+  if ($op == 'list') {
+    $blocks['userpoints_history'] = array(
+      'info' => t('Userpoints history graph'),
+    );
+    return $blocks;
+  }
+  else if ($op == 'view') {
+    switch ($delta) {
+      case 'userpoints_history':
+        $access = false;
+        if ( arg(0) == 'user' && is_numeric(arg(1)) ) {
+          $uid = arg(1);
+          if (user_access('access history information')) {
+            $access = true;
+          }
+        }
+        else {
+          global $user;
+          $uid = $user->uid;
+          if (user_access('access own history information')) {
+            $access = true;
+          }
+        }
+        $content = ''; // empty if no access
+        if ( $access ) {
+          $content = userpoints_history_view($uid);
+        }
+        $block = array(
+          'subject' => t('Points History'), 
+          'content' => $content,
+        );
+        break;
+    }
+    return $block;
+  }
+}
+
+// Had to move this into the module file so the block could also use it
+/*
+ * Create and return a rendered chart of userpoints using chart API
+ * for this user and categories
+ */
+function userpoints_history_view($uid = NULL, $tid = NULL) {
+
+//No user, no graph..
+//@TODO: discuss if current user should be used instead of returning
+  if (!intval($uid)) return;
+
+//get requested categories for filtering purposes
+  $cat = userpoints_get_categories();
+
+  $filter = array();
+//use tid as filter, or array of filters if separated by ','
+//@TODO: Clean this part of code, not sure if it works
+  if($tid){
+    if(is_numeric($tid)){
+      $filter[intval($tid)] = $cat[intval($tid)];
+    }
+    else {
+      foreach(explode(',', $tid) as $xtid) {
+        $filter[intval($xtid)] = $cat[intval($xtid)];
+      }
+    }
+  }
+  else {
+    $filter = $cat;
+  }
+
+  //filter is an array of different categories to show..
+  //Create the chart information:
+  //@TODO: create more options to set titles and so in the settings
+  $bgcolor = variable_get('userpoints_history_bgcolor', '');
+  //Get image size
+  $imgsize = variable_get('userpoints_history_imgsize', '400x300');
+  list($imgwidth, $imgheigth) = explode('x', strtolower($imgsize));
+  $chart = array(
+    '#chart_id' => 'userpoints_history_timeline',
+    '#title'    => chart_title(t('Userpoints evolution'), '', 15),
+    '#type'     => CHART_TYPE_LINE,
+    '#size'     => chart_size($imgwidth, $imgheigth),
+    '#adjust_resolution' => TRUE,
+  );
+
+
+
+
+
+  $max = 0;
+  $min = 0;
+  $step = 3600*24;
+  $length = 8;
+  $dt = localtime(time()+$step, true);
+  $time = mktime(0, 0, 0, $dt['tm_mon']+1, $dt['tm_mday'], $dt['tm_year'] +1900);
+
+
+// set each selected category information..
+  foreach($filter as $tid => $name){
+
+    $start = $time - ($step * $length); // 7 = one week
+    // set legend and color for this category..
+    $chart['#legends'][] = t($name);
+    $chart['#data_colors'][] = chart_unique_color('test_'.$tid);
+
+	// First, get initial point value for the start timestamp
+	$total = 0;
+	// now, query about changes (TODO: consider status)
+	$txns = db_query("SELECT points FROM {userpoints_txn} WHERE expired = 0 AND status = 0 AND parent_txn_id = 0 AND uid = %d AND tid = %d AND time_stamp < %d ORDER BY time_stamp ASC", $uid, $tid, $start);
+	while ($data = db_fetch_object($txns)){
+	  $total += $data->points;
+	}
+ //   drupal_set_message(t('category !cat starts with !points at !time',array('!cat'=>$name, '!points'=>$total ,'!time'=> format_date($start, 'custom', 'D,j/M G:i:s' ))));
+	$max = max($max, $total);
+
+	// now, query about changes
+	$txns = db_query("SELECT points, time_stamp FROM {userpoints_txn} WHERE expired = 0 AND status = 0 AND parent_txn_id = 0 AND uid = %d AND tid = %d AND time_stamp >= %d AND time_stamp <= %d ORDER BY time_stamp ASC", $uid, $tid, $start, $time+1);
+     while ($start < $time){ // still there are columns to complete .. maybe $end+1 to force one more step?
+        while ($data = db_fetch_object($txns)){ // is there any db data?
+          if($data->time_stamp > $start){ // this data is in future, we need to fill current and following columns with current total..
+            while ($data->time_stamp > $start){ // each missing step is added here..
+                $chart['#data'][$name][$start] = $total;
+                $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][0][$start] = chart_mixed_axis_label(format_date($start, 'custom', 'j/M' ));
+                $start += $step;
+//                drupal_set_message(t('category !cat has x with !points at !time', array('!cat'=>$name, '!points'=>$total ,'!time'=> format_date($start, 'custom', 'D,j/M G:i:s' ))));
+            } // Ok points are now in the past.. perform regularly..
+          }
+          // add points now..
+          $total += $data->points;
+          $max = max($max, $total);
+//          drupal_set_message(t('category !cat has with !points at !time', array('!cat'=>$name, '!points'=>$total ,'!time'=> format_date($start, 'custom', 'D,j/M G:i:s' ))));
+	    } // No more objects in db..
+        // continue, keep value, and next round?..
+        $chart['#data'][$name][$start] = $total;
+        $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][0][$start] = chart_mixed_axis_label(format_date($start, 'custom', 'j/M' ));
+        $start += $step;
+//        drupal_set_message(t('category !cat has e with !points at !time', array('!cat'=>$name, '!points'=>$total ,'!time'=> format_date($start, 'custom', 'D,j/M G:i:s' ))));
+      }
+    }
+
+//  We should now remove expired information, it's, remove the expired data at expiring date..
+    $start = $time - ($step * $length); // 7 = one week
+	$txns = db_query("SELECT points,expirydate FROM {userpoints_txn} WHERE expired = 1 AND status = 0 AND uid = %d AND tid = %d AND time_stamp >= %d AND time_stamp <= %d ORDER BY time_stamp ASC", $uid, $tid, $start, $time+1);
+    while ($start < $time){
+        while ($data = db_fetch_object($txns)){ // is there any db data?
+          while($data->expirydate > $start){ // this data is in future, we need to fill current and following columns with current total..
+            $start += $step;
+          }
+        }
+        $chart['#data'][$name][$start] -= $data->points;
+        $start += $step;
+    }
+
+
+  $ymin = 0;
+  $ymax = $max;
+  //Get max and min values of data, and set Y axis label in the chart
+  $chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][0][] = chart_mixed_axis_range_label($ymin, $ymax);
+// Set chart axis to human readable labels, @TODO: calc their values to be fitted..
+  $chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][1][] = chart_mixed_axis_label(t('Points'), 95);
+  $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(t('Dates'), 50);
+  //@TODO: discuss if grid should be shown, because needs some calcs
+  //$chart['#grid_lines'] = chart_grid_lines((100/($length-1)), (10)); // 10% each line separation
+
+  // finished, get the chart rendered, and return
+  $output = chart_render($chart);
+  return $output;
+}
+
diff --git a/sites/all/modules/userpoints_history/userpoints_history.pages.inc b/sites/all/modules/userpoints_history/userpoints_history.pages.inc
deleted file mode 100644
index 4118750..0000000
--- a/sites/all/modules/userpoints_history/userpoints_history.pages.inc
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-// $Id: userpoints_history.pages.inc,v 1.1.2.1 2009/07/15 21:40:00 ilo Exp $
-
-/**
- *  @file
- *  User pages for the userpoints history module
- *
- */
-
-
-/*
- * Create and return a rendered chart of userpoints using chart API
- * for this user and categories
- */
-function userpoints_history_view($uid = NULL, $tid = NULL) {
-
-//No user, no graph..
-//@TODO: discuss if current user should be used instead of returning
-  if (!intval($uid)) return;
-
-//get requested categories for filtering purposes
-  $cat = userpoints_get_categories();
-
-  $filter = array();
-//use tid as filter, or array of filters if separated by ','
-//@TODO: Clean this part of code, not sure if it works
-  if($tid){
-    if(is_numeric($tid)){
-      $filter[intval($tid)] = $cat[intval($tid)];
-    }
-    else {
-      foreach(explode(',', $tid) as $xtid) {
-        $filter[intval($xtid)] = $cat[intval($xtid)];
-      }
-    }
-  }
-  else {
-    $filter = $cat;
-  }
-
-  //filter is an array of different categories to show..
-  //Create the chart information:
-  //@TODO: create more options to set titles and so in the settings
-  $bgcolor = variable_get('userpoints_history_bgcolor', '');
-  //Get image size
-  $imgsize = variable_get('userpoints_history_imgsize', '400x300');
-  list($imgwidth, $imgheigth) = explode('x', strtolower($imgsize));
-  $chart = array(
-    '#chart_id' => 'userpoints_history_timeline',
-    '#title'    => chart_title(t('Userpoints evolution'), '', 15),
-    '#type'     => CHART_TYPE_LINE,
-    '#size'     => chart_size($imgwidth, $imgheigth),
-    '#adjust_resolution' => TRUE,
-  );
-
-
-
-
-
-  $max = 0;
-  $min = 0;
-  $step = 3600*24;
-  $length = 8;
-  $dt = localtime(time()+$step, true);
-  $time = mktime(0, 0, 0, $dt['tm_mon']+1, $dt['tm_mday'], $dt['tm_year'] +1900);
-
-
-// set each selected category information..
-  foreach($filter as $tid => $name){
-
-    $start = $time - ($step * $length); // 7 = one week
-    // set legend and color for this category..
-    $chart['#legends'][] = t($name);
-    $chart['#data_colors'][] = chart_unique_color('test_'.$tid);
-
-	// First, get initial point value for the start timestamp
-	$total = 0;
-	// now, query about changes (TODO: consider status)
-	$txns = db_query("SELECT points FROM {userpoints_txn} WHERE expired = 0 AND status = 0 AND parent_txn_id = 0 AND uid = %d AND tid = %d AND time_stamp < %d ORDER BY time_stamp ASC", $uid, $tid, $start);
-	while ($data = db_fetch_object($txns)){
-	  $total += $data->points;
-	}
- //   drupal_set_message(t('category !cat starts with !points at !time',array('!cat'=>$name, '!points'=>$total ,'!time'=> format_date($start, 'custom', 'D,j/M G:i:s' ))));
-	$max = max($max, $total);
-
-	// now, query about changes
-	$txns = db_query("SELECT points, time_stamp FROM {userpoints_txn} WHERE expired = 0 AND status = 0 AND parent_txn_id = 0 AND uid = %d AND tid = %d AND time_stamp >= %d AND time_stamp <= %d ORDER BY time_stamp ASC", $uid, $tid, $start, $time+1);
-     while ($start < $time){ // still there are columns to complete .. maybe $end+1 to force one more step?
-        while ($data = db_fetch_object($txns)){ // is there any db data?
-          if($data->time_stamp > $start){ // this data is in future, we need to fill current and following columns with current total..
-            while ($data->time_stamp > $start){ // each missing step is added here..
-                $chart['#data'][$name][$start] = $total;
-                $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][0][$start] = chart_mixed_axis_label(format_date($start, 'custom', 'j/M' ));
-                $start += $step;
-//                drupal_set_message(t('category !cat has x with !points at !time', array('!cat'=>$name, '!points'=>$total ,'!time'=> format_date($start, 'custom', 'D,j/M G:i:s' ))));
-            } // Ok points are now in the past.. perform regularly..
-          }
-          // add points now..
-          $total += $data->points;
-          $max = max($max, $total);
-//          drupal_set_message(t('category !cat has with !points at !time', array('!cat'=>$name, '!points'=>$total ,'!time'=> format_date($start, 'custom', 'D,j/M G:i:s' ))));
-	    } // No more objects in db..
-        // continue, keep value, and next round?..
-        $chart['#data'][$name][$start] = $total;
-        $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][0][$start] = chart_mixed_axis_label(format_date($start, 'custom', 'j/M' ));
-        $start += $step;
-//        drupal_set_message(t('category !cat has e with !points at !time', array('!cat'=>$name, '!points'=>$total ,'!time'=> format_date($start, 'custom', 'D,j/M G:i:s' ))));
-      }
-    }
-
-//  We should now remove expired information, it's, remove the expired data at expiring date..
-    $start = $time - ($step * $length); // 7 = one week
-	$txns = db_query("SELECT points,expirydate FROM {userpoints_txn} WHERE expired = 1 AND status = 0 AND uid = %d AND tid = %d AND time_stamp >= %d AND time_stamp <= %d ORDER BY time_stamp ASC", $uid, $tid, $start, $time+1);
-    while ($start < $time){
-        while ($data = db_fetch_object($txns)){ // is there any db data?
-          while($data->expirydate > $start){ // this data is in future, we need to fill current and following columns with current total..
-            $start += $step;
-          }
-        }
-        $chart['#data'][$name][$start] -= $data->points;
-        $start += $step;
-    }
-
-
-  $ymin = 0;
-  $ymax = $max;
-  //Get max and min values of data, and set Y axis label in the chart
-  $chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][0][] = chart_mixed_axis_range_label($ymin, $ymax);
-// Set chart axis to human readable labels, @TODO: calc their values to be fitted..
-  $chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][1][] = chart_mixed_axis_label(t('Points'), 95);
-  $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][1][] = chart_mixed_axis_label(t('Dates'), 50);
-  //@TODO: discuss if grid should be shown, because needs some calcs
-  //$chart['#grid_lines'] = chart_grid_lines((100/($length-1)), (10)); // 10% each line separation
-
-  // finished, get the chart rendered, and return
-  $output = chart_render($chart);
-  return $output;
-}
-
