diff --git a/userpoints_download/userpoints_download.info b/userpoints_download/userpoints_download.info
index b4d0e9f..0e7d63e 100644
--- a/userpoints_download/userpoints_download.info
+++ b/userpoints_download/userpoints_download.info
@@ -1,6 +1,6 @@
 name = Userpoints Download
-description = Deduct points from users when they download private files
+description = Deduct points from users when they download private files.
 package = Userpoints
-core = 6.x
+core = 7.x
+configure = admin/config/people/userpoints/settings
 dependencies[] = userpoints
-dependencies[] = upload
diff --git a/userpoints_download/userpoints_download.install b/userpoints_download/userpoints_download.install
new file mode 100644
index 0000000..47066df
--- /dev/null
+++ b/userpoints_download/userpoints_download.install
@@ -0,0 +1,33 @@
+<?php
+
+/*
+ * @file
+ * Provides for uninstall cleanup of userpoints_register variables.
+ */
+
+
+/**
+ * Implementation of hook_install().
+ */
+function userpoints_download_install() {
+  if (!userpoints_download_check_method()) {
+    drupal_set_message(t('Download method is not set to private. In order for users to earn or lose points for downloads, the !method has to be changed to private.',
+      array('!method' => l('download method', 'admin/config/media/file-system'))), 'error');
+  }
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function userpoints_download_uninstall() {
+  $extensions = variable_get('userpoints_download_extensions');
+  variable_del('userpoints_download_enabled');
+  variable_del('userpoints_download_extensions');
+  $extensions = explode(' ', strtolower(trim(variable_get('userpoints_download_extensions', ''))));
+  foreach ($extensions as $extension) {
+    $extension = strtolower(trim($extension));
+    variable_del('userpoints_download_category_' . $extension);
+    variable_del('userpoints_download_points_' . $extension);
+    variable_del('userpoints_download_disallow_' . $extension);
+  }
+}
\ No newline at end of file
diff --git a/userpoints_download/userpoints_download.js b/userpoints_download/userpoints_download.js
new file mode 100644
index 0000000..c5b82ef
--- /dev/null
+++ b/userpoints_download/userpoints_download.js
@@ -0,0 +1,17 @@
+(function ($) {
+  Drupal.behaviors.userpointsDownloadFieldsetSummaries = {
+    attach: function (context) {
+      $('fieldset#edit-userpoints-download', context).drupalSetSummary(function (context) {
+        var params = {
+          '@extensions': $('#edit-userpoints-download-extensions', context).val(),
+        }
+        if ($('#edit-userpoints-download-enabled').is(':checked')) {
+          return Drupal.t('Enabled (@extensions)', params);
+        }
+        else {
+          return Drupal.t('Disabled (@extensions)', params);
+        }
+      })
+    }
+  };
+})(jQuery);
\ No newline at end of file
diff --git a/userpoints_download/userpoints_download.module b/userpoints_download/userpoints_download.module
index 042f9f0..7d8dca5 100644
--- a/userpoints_download/userpoints_download.module
+++ b/userpoints_download/userpoints_download.module
@@ -1,101 +1,157 @@
 <?php
 
-define('USERPOINTS_DOWNLOAD_POINTS',     'userpoints_download_points');
-define('USERPOINTS_DOWNLOAD_TID',        'userpoints_download_tid');
-define('USERPOINTS_DOWNLOAD_EXTENSIONS', 'userpoints_download_extensions');
-
+/*
+ * @file
+ * Add or subtract points for accessing downloads.
+ *
+ * Depends on upload.module, and private file system configuration.
+ * Updated to Drupal 7 by Bastlynn (bastlynn@gmail.com)
+ */
+
+/*
+ * Implements hook_userpoints().
+ *
+ * Adding a cost per extension type - we're following the same pattern set up by allowing a cost per node.
+ * I'm tempeted to allow for multiple costs per multiple extensions, but that's a little too complex at the moment.
+ */
 function userpoints_download_userpoints($op, $params = array()) {
   if ($op == 'setting') {
-
     if (!userpoints_download_check_method()) {
       // This should really be a hook_requirements() in a .install file
-      drupal_set_message(t('Download method is not set to private. In order for users to earn or lose points for download, the !method has to be changed to private.', array('!method' => l('download method', 'admin/settings/file-system'))), 'error');
+      drupal_set_message(t('Download method is not set to private. In order for users to earn or lose points for downloads, the !method has to be changed to private.',
+        array('!method' => l('download method', 'admin/config/media/file-system'))), 'error');
     }
-
-    $group = 'download';
-    $form[$group] = array(
-      '#type'          => 'fieldset',
-      '#title'         => t('Download'),
-      '#collapsible'   => TRUE,
-      '#collapsed'     => TRUE,
-      '#description'   => t("Points a user will earn, or lose when they download an attachment. Note that this module requires that the 'upload' module be enabled, and that Drupal's file download method is set to 'private'. Otherwise, you will get unexpected results."),
-    );
-
-    $form[$group][USERPOINTS_DOWNLOAD_POINTS] = array(
-      '#type'          => 'textfield',
-      '#title'         => t('Points to add/deduct for download'),
-      '#default_value' => variable_get(USERPOINTS_DOWNLOAD_POINTS, 0),
-      '#description'   => t("Points to add to or deduct from a user when they download an attachment. Use a negatie number if you want users to lose points for downloading. For example, for a user to lose 2 points for download, use '-2'. To make users earn 3 points, use just '3'."),
+    $form['userpoints_download'] = array(
+      '#type' => 'fieldset',
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#title' => t('!Points download', userpoints_translation()),
+      '#description' => t('!Points a user will earn, or lose when they download an attachment. Note that this module requires that the upload module be enabled, '.
+        'and that the file download method is set to private. Otherwise, you will get unexpected results.', userpoints_translation()),
+      '#group' => 'settings_additional',
+      '#weight' => 25,
+      '#attached' => array(
+        'js' => array(
+          'userpoints_download' => drupal_get_path('module', 'userpoints_download') . '/userpoints_download.js',
+        ),
+      ),
     );
-
-    $form[$group][USERPOINTS_DOWNLOAD_TID] = array(
-      '#type'          => 'select',
-      '#title'         => t('Category'),
-      '#default_value' => variable_get(USERPOINTS_DOWNLOAD_TID, 0),
-      '#options'       => userpoints_get_categories(),
-      '#description'   => t('Category of download points. Ignore this if you are not using categories.'),
+    $form['userpoints_download']['userpoints_download_enabled'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enabled by default'),
+      '#default_value' => variable_get('userpoints_download_enabled', TRUE),
+      '#description' => t('If checked, downloads will be checked for !point costs and awards.', userpoints_translation()),
     );
-
-    $form[$group][USERPOINTS_DOWNLOAD_EXTENSIONS] = array(
-      '#type'          => 'textfield',
-      '#title'         => t('Extensions'),
-      '#default_value' => variable_get(USERPOINTS_DOWNLOAD_EXTENSIONS, ''),
-      '#description'   => t("Only extensions that are listed here will add or deduct points. All other extensions will be ignored, and will not add nor deduct any points. Enter the extensions separated by a space. For example, if you only want Open Office text documents and spreadsheets to add or deduct polints, then enter 'odt ods'"),
+    $form['userpoints_download']['userpoints_download_extensions'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Extensions'),
+      '#default_value' => variable_get('userpoints_download_extensions', ''),
+      '#description' => t('Extensions to check for download costs. List extensions separated by a space.', userpoints_translation()),
     );
-
+    /* To do: Add variable costs and categories per extension - perhaps display as a table? */
+    $categories = userpoints_get_categories();
+    $extensions = variable_get('userpoints_download_extensions', '');
+    $extensions = explode(' ', strtolower(trim(variable_get('userpoints_download_extensions', ''))));
+    foreach ($extensions as $extension) {
+      $extension = strtolower(trim($extension));
+      $form['userpoints_download']['userpoints_download_category_' . $extension] = array(
+        '#type' => 'select',
+        '#title' => t($extension . ' category'),
+        '#default_value' => variable_get('userpoints_download_category_' . $extension, 0),
+        '#options' => $categories,
+        '#description' => t('Category of download !points.', userpoints_translation()),
+      );
+      $form['userpoints_download']['userpoints_download_points_' . $extension] = array(
+        '#type' => 'textfield',
+        '#title' => t($extension . ' !points', userpoints_translation()),
+        '#default_value' => variable_get('userpoints_download_points_' . $extension, 0),
+        '#description' => t('!Points to add to or deduct from a user when they download an attachment.', userpoints_translation()),
+      );
+      $form['userpoints_download']['userpoints_download_disallow_' . $extension] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Prevent download of this extension if the user does not have enough !points.', userpoints_translation()),
+        '#default_value' => variable_get('userpoints_download_disallow_' . $extension, TRUE),
+      );
+    }
+    /* Add a new extension setting. */
     return $form;
   }
 }
 
-function userpoints_download_file_download($filepath = NULL) {
-  global $user;
-
-  if (!$user->uid) {
-    // This is an anonymous user, do nothing ...
-    return;
-  }
-
-  if (!userpoints_download_check_method()) {
-    return;
-  }
-
-  $extensions = explode(' ', strtolower(trim(variable_get(USERPOINTS_DOWNLOAD_EXTENSIONS, ''))));
-  if (!count($extensions)) {
-    // No extensions configured, do nothing
-    return;
-  }
-
-  // Search for the current file extension in the list of extensions
-  $file_ext = strtolower(array_pop(explode('.', $filepath)));
-  if (!in_array($file_ext, $extensions)) {
-    // Extension not found in list of extensions
-    return;
-  }
-
-  $points = variable_get(USERPOINTS_DOWNLOAD_POINTS, 0);
-  if (!$points) {
-    // Admin has not configured any points for download, do nothing ...
-    return;
+/*
+ * Implements hook_file_download().
+ */
+function userpoints_download_file_download($uri = NULL) {
+  if (variable_get('userpoints_download_enabled', TRUE)) {
+    global $user;
+    $extensions = variable_get('userpoints_download_extensions', '');
+    $file_ext = strtolower(array_pop(explode('.', $uri)));
+    $points = variable_get('userpoints_download_points_' . $file_ext, 0);
+    $category = variable_get('userpoints_download_category_' . $file_ext, 0);
+    $disallow = variable_get('userpoints_download_disallow_' . $file_ext, TRUE);
+    if (!$user->uid || !userpoints_download_check_method() || empty($extensions) || strpos($extensions, $file_ext) === FALSE || $points == 0) {
+      // The user is Anonymous.
+      // Or the download setting is public.
+      // Or there are no extensions set.
+      // Or the filepath extension is not in the set extensions.
+      // Or there is no cost for points.
+      // In all of these cases, we aren't going to cost points - so we return early.
+      return NULL;
+    }
+    // Check if the user has enough points to pay for this.
+    if (!$disallow || userpoints_download_check_points($file_ext)) {
+      // Charge the user for the download.
+      $params = array(
+        'points' => $points,
+        'tid' => $category,
+        'uid' => $user->uid,
+        'operation' => 'userpoints_download',
+      );
+      userpoints_userpointsapi($params);
+      return NULL; // Either allowed to go negative, or user had enough points.
+    }
+    else {
+      return -1; // Not allowed.
+    }
   }
+}
 
-  userpoints_userpointsapi(array(
-    'uid'         => $user->uid,
-    'points'      => $points,
-    'tid'         => variable_get(USERPOINTS_DOWNLOAD_TID, 0),
-    'operation'   => 'download',
-    'description' => 'Download ' . $filepath,
-    )
+/*
+ * Implements hook_userpoints_info().
+ */
+function userpoints_download_userpoints_info() {
+  return array(
+    'userpoints_download' => array(
+      'description' => t('!Points cost for download.', userpoints_translation()),
+      'admin description' => t('Points cost for download'),
+    ),
   );
-
-  return;
 }
 
+/*
+ * Helper function to check currently configured download method.
+ * Return true if private download is enabled.
+ */
 function userpoints_download_check_method() {
-  if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
+  if (file_default_scheme() == 'private') {
     return TRUE;
   }
   else {
-    // File downloads are not set to Private, do nothing ...
     return FALSE;
   }
 }
+
+/**
+ *  Helper function to check if user has sufficient points to download a file of a certain type.
+ */
+function userpoints_download_check_points($extension) {
+  global $user;
+  $current_points = userpoints_get_current_points($user->uid, variable_get('userpoints_download_category_'. $extension, 0));
+  $file_points = variable_get('userpoints_download_points_'. $extension, 0);
+  if ($current_points >= $file_points) {
+    return TRUE;
+  }
+  else {
+    return FALSE;
+  }
+}
\ No newline at end of file
