diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 4819c3a..b5267b8 100755
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,9 @@
+Mentions 7.x-1.x-dev, xxxx-xx-xx (development release)
+----------------------------
+
+- Updated module for Drupal 7.
+- Refined variables to single variable.
+- Removed Facebook Stats integration as no D6 release.
 
 Mentions 6.x-1.x-dev, xxxx-xx-xx (development release)
 ----------------------------
diff --git a/includes/mentions.views.inc b/includes/mentions.views.inc
index d168ea5..5ea11fa 100755
--- a/includes/mentions.views.inc
+++ b/includes/mentions.views.inc
@@ -5,12 +5,12 @@
  */
 
 /**
- * Implementation of hook_views_handlers().
+ * Implements hook_views_handlers().
  */
 function mentions_views_handlers() {
   return array(
     'info' => array(
-      'path' => drupal_get_path('module', 'mentions') .'/includes',
+      'path' => drupal_get_path('module', 'mentions') . '/includes',
     ),
     'handlers' => array(
       'mentions_views_handler_field_content' => array(
@@ -30,7 +30,7 @@ function mentions_views_handlers() {
 }
 
 /**
- * Implementation of hook_views_data().
+ * Implements hook_views_data().
  */
 function mentions_views_data() {
   $data['mentions']['table']['group']  = t('Mentions');
@@ -122,7 +122,7 @@ function mentions_views_data() {
 
 function mentions_views_data_alter(&$data) {
   foreach (module_list() as $module) {
-    if (function_exists($function = 'mentions_'. $module .'_views_data_alter')) {
+    if (function_exists($function = 'mentions_' . $module . '_views_data_alter')) {
       $function($data);
     }
   }
diff --git a/includes/mentions.views_default.inc b/includes/mentions.views_default.inc
index 9428601..8aad201 100755
--- a/includes/mentions.views_default.inc
+++ b/includes/mentions.views_default.inc
@@ -5,13 +5,13 @@
  */
 
 /**
- * Implementation of hook_views_default_views().
+ * Implements hook_views_default_views().
  */
 function mentions_views_default_views() {
   /*
    * View 'mentions'
    */
-  $view = new view;
+  $view = new view();
   $view->name = 'mentions';
   $view->description = 'Displays @username style Mentions made in all Nodes and Comments.';
   $view->tag = '';
diff --git a/includes/mentions_views_handler_field_content.inc b/includes/mentions_views_handler_field_content.inc
index caca99d..815829b 100755
--- a/includes/mentions_views_handler_field_content.inc
+++ b/includes/mentions_views_handler_field_content.inc
@@ -10,7 +10,7 @@ class mentions_views_handler_field_content extends views_handler_field {
 
     // Invoke mentions_hook_views_handler_field_content_fields().
     foreach (module_list() as $module) {
-      if (function_exists($function = 'mentions_'. $module .'_views_handler_field_content_fields')) {
+      if (function_exists($function = 'mentions_' . $module . '_views_handler_field_content_fields')) {
         $function($this);
       }
     }
@@ -23,7 +23,7 @@ class mentions_views_handler_field_content extends views_handler_field {
 
   function render($values) {
     // Invoke mentions_hook_views_handler_field_content().
-    if (function_exists($function = 'mentions_'. $values->{$this->aliases['type']} .'_views_handler_field_content')) {
+    if (function_exists($function = 'mentions_' . $values->{$this->aliases['type']} . '_views_handler_field_content')) {
       $function($this, $values, $link);
 
       return check_markup($function($this, $values));
diff --git a/includes/mentions_views_handler_field_link.inc b/includes/mentions_views_handler_field_link.inc
index e20edc6..0f49ce0 100755
--- a/includes/mentions_views_handler_field_link.inc
+++ b/includes/mentions_views_handler_field_link.inc
@@ -1,6 +1,7 @@
 <?php
 /**
  * @file
+ *
  * Field handler to present a link to mention.
  */
 class mentions_views_handler_field_link extends views_handler_field {
@@ -11,7 +12,7 @@ class mentions_views_handler_field_link extends views_handler_field {
 
     // Invoke mentions_hook_views_handler_field_link_fields().
     foreach (module_list() as $module) {
-      if (function_exists($function = 'mentions_'. $module .'_views_handler_field_link_fields')) {
+      if (function_exists($function = 'mentions_' . $module . '_views_handler_field_link_fields')) {
         $function($this);
       }
     }
@@ -43,7 +44,7 @@ class mentions_views_handler_field_link extends views_handler_field {
     $link = array('options' => array());
 
     // Invoke mentions_hook_views_handler_field_link().
-    if (function_exists($function = 'mentions_'. $values->{$this->aliases['type']} .'_views_handler_field_link')) {
+    if (function_exists($function = 'mentions_' . $values->{$this->aliases['type']} . '_views_handler_field_link')) {
       $function($this, $values, $link);
 
       $text = !empty($this->options['text']) ? $this->options['text'] : t('view');
diff --git a/includes/mentions_views_handler_field_title.inc b/includes/mentions_views_handler_field_title.inc
index a4e683e..1084d8e 100755
--- a/includes/mentions_views_handler_field_title.inc
+++ b/includes/mentions_views_handler_field_title.inc
@@ -1,6 +1,7 @@
 <?php
 /**
  * @file
+ *
  * Field handler to present a link to mention.
  */
 class mentions_views_handler_field_title extends views_handler_field {
@@ -10,7 +11,7 @@ class mentions_views_handler_field_title extends views_handler_field {
 
     // Invoke mentions_hook_views_handler_field_title_fields().
     foreach (module_list() as $module) {
-      if (function_exists($function = 'mentions_'. $module .'_views_handler_field_title_fields')) {
+      if (function_exists($function = 'mentions_' . $module . '_views_handler_field_title_fields')) {
         $function($this);
       }
     }
@@ -23,7 +24,7 @@ class mentions_views_handler_field_title extends views_handler_field {
 
   function render($values) {
     // Invoke mentions_hook_views_handler_field_title().
-    if (function_exists($function = 'mentions_'. $values->{$this->aliases['type']} .'_views_handler_field_title')) {
+    if (function_exists($function = 'mentions_' . $values->{$this->aliases['type']} . '_views_handler_field_title')) {
       return check_plain($function($this, $values));
     }
 
diff --git a/includes/mentions_views_handler_field_user_name.inc b/includes/mentions_views_handler_field_user_name.inc
index e3840e2..2bdbe3c 100755
--- a/includes/mentions_views_handler_field_user_name.inc
+++ b/includes/mentions_views_handler_field_user_name.inc
@@ -1,7 +1,8 @@
 <?php
 /**
  * @file
- * Field handler to provide simple renderer that allows using a themed user link.
+ *
+ * Field handler providing simple renderer that allows using a themed user link.
  */
 class mentions_views_handler_field_user_name extends views_handler_field_user_name {
   function render_link($data, $values) {
diff --git a/mentions.info b/mentions.info
index c10c9fe..8360148 100755
--- a/mentions.info
+++ b/mentions.info
@@ -1,3 +1,12 @@
 name = Mentions
 description = Adds Twitter like @username linking and tracking features.
-core = 6.x
+core = 7.x
+package = Filters
+configure = admin/config/content/mentions
+dependencies[] = filter
+
+files[] = includes/mentions_views_handler_field_content.inc
+files[] = includes/mentions_views_handler_field_link.inc
+files[] = includes/mentions_views_handler_field_title.inc
+files[] = includes/mentions_views_handler_field_user_name.inc
+files[] = tests/mentions.test
diff --git a/mentions.install b/mentions.install
old mode 100644
new mode 100755
index ffd5713..4a8fee0
--- a/mentions.install
+++ b/mentions.install
@@ -5,19 +5,45 @@
  */
 
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function mentions_schema() {
   $schema['mentions'] = array(
     'fields' => array(
-      'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
-      'mid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-      'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-      'auid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
-      'timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
+      'type' => array(
+        'type' => 'varchar',
+        'length' => 32,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'mid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'uid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'auid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'timestamp' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
     ),
     'indexes' => array(
-      'uid' => array('uid'),
+      'uid' => array(
+        'uid',
+      ),
     ),
   );
 
@@ -25,21 +51,31 @@ function mentions_schema() {
 }
 
 /**
- * Implementation of hook_install().
+ * Implements hook_uninstall().
  */
-function mentions_install() {
-  drupal_install_schema('mentions');
+function mentions_uninstall() {
+  variable_del('mentions');
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Update from drupal 6 mentions
  */
-function mentions_uninstall() {
-  drupal_uninstall_schema('mentions');
+function mentions_update_7100() {
+  // Load variables to transform to new format
+  $defaults = array(
+    'input_prefix' => variable_get('mentions_input_prefix', '[@'),
+    'input_suffix' => variable_get('mentions_input_suffix', ']'),
+    'output_prefix' => variable_get('mentions_output_prefix', '@'),
+    'output_suffix' => variable_get('mentions_output_suffix', ''),
+    'token_content' => variable_get('mentions_output_content', '[user:name]'),
+    'token_link' => '',
+  );
+  variable_set('mentions', $settings);
 
+  // Remove old variables entries
   variable_del('mentions_input_prefix');
   variable_del('mentions_input_suffix');
   variable_del('mentions_output_prefix');
-  variable_del('mentions_output_content');
   variable_del('mentions_output_prefix');
+  variable_del('mentions_output_content');
 }
diff --git a/mentions.module b/mentions.module
index 0800202..2a1d6ea 100755
--- a/mentions.module
+++ b/mentions.module
@@ -5,129 +5,110 @@
  */
 
 /**
- * Implementation of hook_theme().
+ * Include additional files.
+ */
+foreach (module_list() as $module) {
+  if (file_exists($file = dirname(__FILE__) . "/includes/{$module}.inc")) {
+    require_once $file;
+  }
+}
+
+/**
+ * Implements hook_menu().
+ */
+function mentions_menu() {
+  $items = array();
+
+  $items['admin/config/content/mentions'] = array(
+    'title' => 'Mentions',
+    'type' => MENU_NORMAL_ITEM,
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('mentions_form'),
+    'access callback' => 'user_access',
+    'access arguments' => array('administer filters'),
+  );
+
+  return $items;
+}
+
+/**
+ * Implements hook_theme().
  */
 function mentions_theme($existing, $type, $theme, $path) {
   return array(
     'mentions' => array(
-      'arguments' => array('user' => array()),
+      'variables' => array(
+        'user' => array(),
+      ),
     ),
     'mentions_input' => array(
-      'arguments' => array('text' => NULL, 'raw' => FALSE),
+      'variables' => array(
+        'text' => NULL,
+        'raw' => FALSE,
+      ),
     ),
     'mentions_filter_settings' => array(
-      'arguments' => array('form' => array()),
+      'variables' => array(
+        'form' => array(),
+      ),
     ),
   );
 }
 
 /**
- * Implementation of hook_init().
+ * Implements hook_filter_info().
  */
-function mentions_init() {
-  foreach (module_list() as $module) {
-    if (file_exists($file = drupal_get_path('module', 'mentions') .'/modules/'. $module .'.inc')) {
-      require_once $file;
-    }
-  }
+function mentions_filter_info() {
+  $prefix = variable_get('mentions_input_prefix', '[@');
+  $suffix = variable_get('mentions_input_suffix', ']');
+
+  $filters['filter_mentions'] = array(
+    'title' => t("Mentions filter"),
+    'description' => t("Converts {$prefix}username{$suffix} and {$prefix}#uid{$suffix} into a link the user's profile page."),
+    'process callback' => '_filter_mentions',
+    'tips callback' => '_filter_mentions_tips',
+  );
+
+  return $filters;
 }
 
-/**
- * Implementation of hook_filter_tips().
- */
-function mentions_filter_tips($delta, $format, $long = FALSE) {
-  return t("!username or !uid creates a link the user's profile page.", array('!username' => theme('mentions_input', 'username'), '!uid' => theme('mentions_input', '#uid')));
+function mentions_defaults() {
+  $defaults = array(
+    'input_prefix' => '[@',
+    'input_suffix' => ']',
+    'output_prefix' => '@',
+    'output_suffix' => '',
+    'token_content' => '[user:name]',
+    'token_link' => '',
+  );
+
+  return $defaults;
 }
 
 /**
- * Implementation of hook_filter().
+ * Process callback for Mentions filter.
  */
-function mentions_filter($op, $delta = 0, $format = -1, $text = '') {
-  switch ($op) {
-    case 'list':
-      return array(0 => t("Mentions filter"));
-
-    case 'description':
-      return t("Converts !username and !uid into a link the user's profile page.", array('!username' => theme('mentions_input', 'username'), '!uid' => theme('mentions_input', '#uid')));
-
-    case 'process':
-      foreach (mentions_find_users($text) as $match) {
-        $text = str_replace($match['text'], theme('mentions', $match['user']), $text);
-      }
-
-      return $text;
-
-    case 'settings':
-      $form = array();
-
-      $form['mentions'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Mentions filter'),
-        '#collapsible' => TRUE,
-        '#theme' => 'mentions_filter_settings',
-        '#description' =>
-          t('Define input and output patterns for the Mentions filter.')
-          .'<p>'.
-            '<strong>'. t('Note:') .'</strong> '. t('If you do not define an input suffix, usernames containing a space will not work correctly.') .'<br />'.
-            '<strong>'. t('Warning:') .'</strong> '. t('If you do not define an input prefix, usernames containing a space will not work correctly
-             and you may receive false positives, break HTML elements and your site layout, and add unnecessary server load. It is strongly suggested to use an Input filter.')
-          .'</p>'
-        ,
-      );
-
-      $form['mentions']['input'] = array(
-        '#value' => t('Input') .':',
-      );
-      $form['mentions']['input']['mentions_input_prefix'] = array(
-        '#title' => 'Input prefix',
-        '#type' => 'textfield',
-        '#size' => 2,
-        '#default_value' => variable_get('mentions_input_prefix', '[@'),
-      );
-      $form['mentions']['input']['mentions_input_suffix'] = array(
-        '#title' => 'Input suffix',
-        '#type' => 'textfield',
-        '#size' => 2,
-        '#default_value' => variable_get('mentions_input_suffix', ']'),
-      );
-
-      $form['mentions']['output'] = array(
-        '#value' => t('Output') .':',
-      );
-      $form['mentions']['output']['mentions_output_prefix'] = array(
-        '#title' => 'Output prefix',
-        '#type' => 'textfield',
-        '#size' => 2,
-        '#default_value' => variable_get('mentions_output_prefix', '@'),
-      );
-      $form['mentions']['output']['mentions_output_suffix'] = array(
-        '#title' => 'Output suffix',
-        '#type' => 'textfield',
-        '#size' => 2,
-        '#default_value' => variable_get('mentions_output_suffix', ''),
-      );
-
-      // Support for token module.
-      if (module_exists('token')) {
-        $form['mentions']['output']['mentions_output_content'] = array(
-          '#type' => 'textfield',
-          '#size' => 20,
-          '#default_value' => variable_get('mentions_output_content', '[user]'),
-        );
-        $form['mentions']['tokens'] = array(
-          '#type' => 'fieldset',
-          '#title' => t('Replacement tokens'),
-          '#collapsible' => TRUE,
-          '#collapsed' => TRUE,
-          '#description' => theme('token_help', 'user'),
-        );
-      }
+function _filter_mentions($text, $filter, $format) {
+  foreach (mentions_find_users($text) as $match) {
+    $text = str_replace($match['text'], theme_mentions($match['user']), $text);
+  }
 
-      return $form;
+  return $text;
+}
 
-    default:
-      return $text;
-  }
+/**
+ * Implements filter_FILTER_tips().
+ */
+function _filter_mentions_tips($format, $long = FALSE) {
+  return t("Converts !username and !uid into a link the user's profile page.",
+    array(
+      '!username' => theme('mentions_input', 'username'),
+      '!uid' => theme('mentions_input', '#uid'),
+    ),
+    array(
+      'context' => '', 'locale' => 'en',
+    )
+  );
 }
 
 /**
@@ -136,13 +117,16 @@ function mentions_filter($op, $delta = 0, $format = -1, $text = '') {
 function _mentions_update($type, $mentions, $mid, $auid) {
   // Build array of old mentions.
   $old_users = array();
-  $result = db_query(
-    "SELECT uid FROM {mentions} WHERE type = '%s' AND mid = %d", $type, $mid
-  );
-  while ($data = db_fetch_object($result)) {
-    $old_users[] = $data->uid;
+  $result = db_select('mentions', 'uid')
+    ->fields('uid')
+    ->condition('type', $type,'=')
+    ->condition('mid', $mid,'=')
+    ->execute();
+
+  while ($data = $result->fetchAssoc()) {
+    $old_users[] = $data['uid'];
   }
-
+dpm($old_users);
   // Build array of new mentions.
   $new_users = array();
   foreach ($mentions as $mention) {
@@ -153,17 +137,24 @@ function _mentions_update($type, $mentions, $mid, $auid) {
 
   // Add new user mentions.
   foreach (array_diff($new_users, $old_users) as $user) {
-    db_query(
-      "INSERT INTO {mentions} (type, mid, uid, auid, timestamp) VALUES ('%s', %d, %d, %d, %d)",
-      $type, $mid, $user, $auid, time()
-    );
+    db_insert('mentions')
+      ->fields(array(
+        'type' => $type,
+        'mid' => $mid,
+        'uid' => $user,
+        'auid' => $auid,
+        'timestamp' => REQUEST_TIME,
+      ))
+      ->execute();
   }
 
   // Remove old mentions.
   foreach (array_diff($old_users, $new_users) as $user) {
-    db_query(
-      "DELETE FROM {mentions} WHERE type = '%s' AND mid = %d AND uid = %d", $type, $mid, $user
-    );
+    db_delete('mentions')
+      ->condition('type', $type)
+      ->condition('mid', $mid)
+      ->condition('uid', $user)
+      ->execute();
   }
 }
 
@@ -171,7 +162,10 @@ function _mentions_update($type, $mentions, $mid, $auid) {
  * Remove mentions on node/comment deletion.
  */
 function _mentions_delete($type, $mid) {
-  db_query("DELETE FROM {mentions} WHERE type = '%s' AND mid = %d", $type, $mid);
+  db_delete('mentions')
+    ->condition('type', $type)
+    ->condition('mid', $mid)
+    ->execute();
 }
 
 /**
@@ -179,32 +173,52 @@ function _mentions_delete($type, $mid) {
  *
  * @param $text
  *   Text string for analysis.
- * @return
+ *
+ * @return array()
  *   An array of matched text and user accounts.
  */
 function mentions_find_users($text) {
+  $settings = variable_get('mentions', mentions_defaults());
+  if (is_array($text)) {
+    $text = $text['und'][0]['value'];
+  }
   $users = array();
 
-  $pattern = variable_get('mentions_input_prefix', '[@') != ''
-    ? (variable_get('mentions_input_suffix', ']') != ''
-      ? '/\B('. preg_quote(variable_get('mentions_input_prefix', '[@')) .'|'. preg_quote(check_plain(variable_get('mentions_input_prefix', '[@'))) .')(\#?.*?)('. preg_quote(variable_get('mentions_input_suffix', ']')) .'|'. preg_quote(check_plain(variable_get('mentions_input_suffix', ']'))) .')/'
-      : '/\B('. preg_quote(variable_get('mentions_input_prefix', '[@')) .'|'. preg_quote(check_plain(variable_get('mentions_input_prefix', '[@'))) .')(\#?\w*)/')
-    : (variable_get('mentions_input_suffix', ']') != ''
-      ? '/(\b|\#)(\w*)('. preg_quote(variable_get('mentions_input_suffix', ']')) .'|'. preg_quote(check_plain(variable_get('mentions_input_suffix', ']'))) .')/'
-      : '/(\b|\#)(\w*)/');
+  if ($settings['input_prefix'] != '') {
+    if ($settings['input_suffix'] != '') {
+      $pattern = '/\B(' . preg_quote($settings['input_prefix']) . '|' . preg_quote(check_plain($settings['input_prefix'])) . ')(\#?.*?)(' . preg_quote($settings['input_suffix']) . '|' . preg_quote(check_plain($settings['input_suffix'])) . ')/';
+    }
+    else {
+      $pattern = '/\B(' . preg_quote($settings['input_prefix']) . '|' . preg_quote(check_plain($settings['input_prefix'])) . ')(\#?\w*)/';
+    }
+  }
+  else {
+    if ($settings['input_suffix'] != '') {
+      $pattern = '/(\b|\#)(\w*)(' . preg_quote($settings['input_suffix']) . '|' . preg_quote(check_plain($settings['input_suffix'])) . ')/';
+    }
+    else {
+      $pattern = '/(\b|\#)(\w*)/';
+    }
+  }
 
   if (preg_match_all($pattern, $text, $matches, PREG_SET_ORDER)) {
     foreach ($matches as $match) {
-      $user = (drupal_substr($match[2], 0, 1) == '#')
-        ? user_load(array('uid' => drupal_substr($match[2], 1)))
-        : (($match[1] == '#')
-          ? user_load(array('uid' => $match[2]))
-          : user_load(array('name' => $match[2])));
+      if (drupal_substr($match[2], 0, 1) == '#') {
+        $user = user_load(drupal_substr($match[2], 1));
+      }
+      else {
+        if ($match[1] == '#') {
+          $user = user_load($match[2]);
+        }
+        else {
+          $user = user_load_by_name($match[2]);
+        }
+      }
 
       if (is_object($user)) {
         $users[] = array(
           'text' => $match[0],
-          'user' => $user
+          'user' => $user,
         );
       }
     }
@@ -214,33 +228,22 @@ function mentions_find_users($text) {
 }
 
 /**
- * Implementation of hook_views_api.
- * Notifies the Views module that we're compatible with a particular API revision.
- */
-function mentions_views_api() {
-  return array(
-    'api' => 2,
-    'path' => drupal_get_path('module', 'mentions') .'/includes',
-  );
-}
-
-/**
  * Return a '@username' link to user's profile.
  *
  * @param $user
  *   A Drupal user account.
  */
 function theme_mentions($user) {
-  $text = !module_exists('token')
-    ? $user->name
-    : token_replace(variable_get('mentions_output_content', '[user]'), 'user', $user);
+  $settings = variable_get('mentions', mentions_defaults());
+  $text = $user->name;
+  drupal_alter('mentions_theme_text', $text, $settings, $user);
 
   $attributes = array(
-    'class' => 'mentions mentions-'. $user->uid,
+    'class' => 'mentions mentions-' . $user->uid,
     'title' => $text,
   );
 
-  return l(variable_get('mentions_output_prefix', '@') . $text . variable_get('mentions_output_suffix', ''), 'user/'. $user->uid, array('attributes' => $attributes));
+  return l($settings['output_prefix'] . $text . $settings['output_suffix'], 'user/' . $user->uid, array('attributes' => $attributes));
 }
 
 /**
@@ -250,47 +253,62 @@ function theme_mentions($user) {
  *   Text to be displayed as mentions input format.
  */
 function theme_mentions_input($text, $raw = FALSE) {
-  $text = variable_get('mentions_input_prefix', '[@') . $text . variable_get('mentions_input_suffix', ']');
-  return $raw ? $text : '<strong>'. $text .'</strong>';
+  $settings = variable_get('mentions', mentions_defaults());
+  $text = $settings['input_prefix'] . $text . $settings['input_suffix'];
+  return $raw ? $text : '<strong>' . $text . '</strong>';
 }
 
-function theme_mentions_filter_settings($form) {
-  global $user;
-
-  $header = array('', t('Prefix'), t('Content'), t('Suffix'), t('Example'));
-  $rows = array();
-
-  $content = array(
-    'input' => $user->name .'<br />'. '#'. $user->uid,
-    'output' => !module_exists('token') ? $user->name : drupal_render($form['output']['mentions_output_content']),
+/**
+ * Page callback for mentions.
+ */
+function mentions_form($form, $form_state) {
+  $settings = variable_get('mentions', mentions_defaults());
+  $form = array();
+
+  $form['mentions'] = array(
+    '#weight' => 0,
+    '#tree' => 1,
+    '#type' => 'fieldset',
+    '#title' => t('Input'),
+    '#collapsible' => FALSE,
+    '#collapsed' => FALSE,
   );
 
-  $details = array(
-    'input' => theme('mentions_input', $user->name) .'<br />'. theme('mentions_input', '#'. $user->uid),
-    'output' => theme('mentions', $user),
+  $form['mentions']['input_prefix'] = array(
+    '#required' => TRUE,
+    '#size' => 2,
+    '#default_value' => $settings['input_prefix'],
+    '#weight' => 1,
+    '#type' => 'textfield',
+    '#title' => t('Input prefix'),
   );
 
-  foreach (element_children($form) as $element) {
-    if ($element == 'tokens') {
-      continue;
-    }
-
-    unset($form[$element]['mentions_'. $element .'_prefix']['#title']);
-    unset($form[$element]['mentions_'. $element .'_suffix']['#title']);
+  $form['mentions']['input_suffix'] = array(
+    '#required' => TRUE,
+    '#size' => 2,
+    '#default_value' => $settings['input_suffix'],
+    '#weight' => 2,
+    '#type' => 'textfield',
+    '#title' => t('Input suffix'),
+  );
 
-    $rows[] = array(
-      '<strong>'. $form[$element]['#value'] .'</strong>',
-      drupal_render($form[$element]['mentions_'. $element .'_prefix']),
-      $content[$element],
-      drupal_render($form[$element]['mentions_'. $element .'_suffix']),
-      $details[$element],
-    );
-  }
+  $form['mentions']['output_prefix'] = array(
+    '#required' => FALSE,
+    '#size' => 2,
+    '#default_value' => $settings['output_prefix'],
+    '#weight' => 3,
+    '#type' => 'textfield',
+    '#title' => t('Output prefix'),
+  );
 
-  $output = theme('table', $header, $rows);
-  if (module_exists('token')) {
-    $output .= drupal_render($form['tokens']);
-  }
+  $form['mentions']['output_suffix'] = array(
+    '#required' => FALSE,
+    '#size' => 2,
+    '#default_value' => $settings['output_suffix'],
+    '#weight' => 4,
+    '#type' => 'textfield',
+    '#title' => t('Output suffix'),
+  );
 
-  return $output;
+  return system_settings_form($form);
 }
diff --git a/modules/comment.inc b/modules/comment.inc
deleted file mode 100755
index 9fc1f80..0000000
--- a/modules/comment.inc
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * @file
- * Contains Comment module integration for the Mentions module.
- */
-
-/**
- * Implementation of hook_comment().
- */
-function mentions_comment(&$a1, $op) {
-  switch ($op) {
-    case 'publish':
-      _mentions_update('comment', mentions_find_users($a1['comment']), $a1['cid'], $a1['uid']);
-      break;
-
-    case 'delete':
-      _mentions_delete('comment', $a1->cid);
-      break;
-  }
-}
-
-/**
- * Flush Comment Mentions if linked Comment no longer exists.
- */
-function _mentions_comment_flush() {
-  db_query("DELETE {mentions} m FROM {mentions} m LEFT JOIN {comments} c ON m.mid = c.cid WHERE m.type = 'comment' AND c.cid IS NULL");
-}
-
-/**
- * Implementation of mentions_hook_views_data_alter().
- */
-function mentions_comment_views_data_alter(&$data) {
-  $data['comments']['table']['join']['mentions'] = array(
-    'left_table' => 'mentions',
-    'left_field' => 'mid',
-    'field' => 'cid',
-  );
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_content_fields().
- */
-function mentions_comment_views_handler_field_content_fields($view) {
-  $view->additional_fields['comment'] = array('table' => 'comments', 'field' => 'comment');
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_content().
- */
-function mentions_comment_views_handler_field_content($view, $values) {
-  return $values->{$view->aliases['comment']};
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_link_fields().
- */
-function mentions_comment_views_handler_field_link_fields($view) {
-  $view->additional_fields['comment_nid'] = array('table' => 'comments', 'field' => 'nid');
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_link().
- */
-function mentions_comment_views_handler_field_link($view, $values, &$link) {
-  $link['url'] = 'node/'. $values->{$view->aliases['comment_nid']};
-  $link['options']['fragment'] = 'comment-'. $values->{$view->aliases['mid']};
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_title_fields().
- */
-function mentions_comment_views_handler_field_title_fields($view) {
-  $view->additional_fields['subject'] = array('table' => 'comments', 'field' => 'subject');
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_title().
- */
-function mentions_comment_views_handler_field_title($view, $values) {
-  return $values->{$view->aliases['subject']};
-}
diff --git a/modules/facebook_status.inc b/modules/facebook_status.inc
deleted file mode 100755
index df0a63c..0000000
--- a/modules/facebook_status.inc
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * @file
- * Contains Facebook-style Statuses module integration for the Mentions module.
- */
-
-/**
- * Implementation of hook_facebook_status_save().
- */
-function mentions_facebook_status_save($account, $status, $sid) {
-  _mentions_update('facebook_status', mentions_find_users($status), $sid, $account->uid);
-}
-
-/**
- * Implementation of mentions_hook_views_data_alter().
- */
-function mentions_facebook_status_views_data_alter(&$data) {
-  $data['facebook_status']['table']['join']['mentions'] = array(
-    'left_table' => 'mentions',
-    'left_field' => 'mid',
-    'field' => 'sid',
-  );
-}
-
-/**
- * Implementation of hook_facebook_status_delete().
- */
-function mentions_facebook_status_delete($sid) {
-  _mentions_delete('facebook_status', $sid);
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_content_fields().
- */
-function mentions_facebook_status_views_handler_field_content_fields($view) {
-  $view->additional_fields['status'] = array('table' => 'facebook_status', 'field' => 'status');
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_content().
- */
-function mentions_facebook_status_views_handler_field_content($view, $values) {
-  return $values->{$view->aliases['status']};
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_title().
- */
-function mentions_facebook_status_views_handler_field_title($view, $values) {
-  return 'Status Update';
-}
diff --git a/modules/node.inc b/modules/node.inc
deleted file mode 100755
index c90197e..0000000
--- a/modules/node.inc
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/**
- * @file
- * Contains Node module integration for the Mentions module.
- */
-
-/**
- * Implementation of hook_nodeapi().
- */
-function mentions_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
-  switch ($op) {
-    case 'insert':
-    case 'update':
-      _mentions_update('node', mentions_find_users($node->body), $node->nid, $node->uid);
-      break;
-
-    case 'delete':
-      _mentions_delete('node', $node->nid);
-
-      // Flush Comment Mentions for deleted Comments link to deleted Node.
-      if (function_exists('_mentions_comment_flush')) {
-        _mentions_comment_flush();
-      }
-      break;
-  }
-}
-
-/**
- * Implementation of mentions_hook_views_data_alter().
- */
-function mentions_node_views_data_alter(&$data) {
-  $data['node_revisions']['table']['join']['mentions'] = array(
-    'left_table' => 'mentions',
-    'left_field' => 'mid',
-    'field' => 'nid',
-  );
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_content_fields().
- */
-function mentions_node_views_handler_field_content_fields($view) {
-  $view->additional_fields['body'] = array('table' => 'node_revisions', 'field' => 'body');
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_content().
- */
-function mentions_node_views_handler_field_content($view, $values) {
-  return $values->{$view->aliases['body']};
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_link().
- */
-function mentions_node_views_handler_field_link($view, $values, &$link) {
-  $link['url'] = 'node/'. $values->{$view->aliases['mid']};
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_title_fields().
- */
-function mentions_node_views_handler_field_title_fields($view) {
-  $view->additional_fields['title'] = array('table' => 'node_revisions', 'field' => 'title');
-}
-
-/**
- * Implementation of mentions_hook_views_handler_field_title().
- */
-function mentions_node_views_handler_field_title($view, $values) {
-  return $values->{$view->aliases['title']};
-}
diff --git a/tests/mentions.test b/tests/mentions.test
index 203112b..e7a5678 100755
--- a/tests/mentions.test
+++ b/tests/mentions.test
@@ -8,7 +8,7 @@ class MentionsTestCase extends DrupalWebTestCase {
   protected $admin_user;
 
   /**
-   * Implementation of getInfo().
+   * Implements getInfo().
    */
   public static function getInfo() {
     return array(
@@ -19,7 +19,7 @@ class MentionsTestCase extends DrupalWebTestCase {
   }
 
   /**
-   * Implementation of setUp().
+   * Implements setUp().
    */
   function setUp() {
     // Install required modules.
@@ -31,7 +31,7 @@ class MentionsTestCase extends DrupalWebTestCase {
     $this->drupalLogin($this->admin_user);
 
     // Enable the Mentions filter for the Filtered HTML Input format.
-    $this->drupalPost('admin/settings/filters/1', array('filters[mentions/0]' => 1), t('Save configuration'));
+    $this->drupalPost('admin/settings/filter/1', array('filters[mentions/0]' => 1), t('Save configuration'));
 
     // Enable comments on Page node type.
     $this->drupalPost('admin/content/node-type/page', array('comment' => 2, 'comment_preview' => 0), t('Save content type'));
@@ -50,39 +50,39 @@ class MentionsTestCase extends DrupalWebTestCase {
     // Check [@username] Mentions in Nodes are filtered.
     $edit = array(
       'title' => $this->randomName(),
-      'body' => 'node-'. theme('mentions_input', $this->admin_user->name, TRUE)
+      'body' => 'node-' . theme('mentions_input', $this->admin_user->name, TRUE)
     );
     $this->drupalPost('node/add/page', $edit, t('Save'));
-    $this->assertRaw('node-'. theme('mentions', $this->admin_user), t('[@username] Mention in Node was filtered.'), 'Mentions');
+    $this->assertRaw('node-' . theme('mentions', $this->admin_user), t('[@username] Mention in Node was filtered.'), 'Mentions');
 
     // Check [@username] Mentions in Comments are filtered.
     $nid = $this->getNodeID();
     $edit = array(
       'subject' => $this->randomName(),
-      'comment' => 'comment-'. theme('mentions_input', $this->admin_user->name, TRUE)
+      'comment' => 'comment-' . theme('mentions_input', $this->admin_user->name, TRUE)
     );
-    $this->drupalPost('comment/reply/'. $nid, $edit, t('Save'));
-    $this->assertRaw('comment-'. theme('mentions', $this->admin_user), t('[@username] Mention in Comment was filtered.'), 'Mentions');
+    $this->drupalPost('comment/reply/' . $nid, $edit, t('Save'));
+    $this->assertRaw('comment-' . theme('mentions', $this->admin_user), t('[@username] Mention in Comment was filtered.'), 'Mentions');
 
     // Check [@#uid] Mentions in Nodes are filtered.
     $edit = array(
       'title' => $this->randomName(),
-      'body' => 'node-'. theme('mentions_input', '#'. $this->admin_user->uid, TRUE)
+      'body' => 'node-' . theme('mentions_input', '#' . $this->admin_user->uid, TRUE)
     );
     $this->drupalPost('node/add/page', $edit, t('Save'));
-    $this->assertRaw('node-'. theme('mentions', $this->admin_user), t('[@#uid] Mention in Node was filtered.'), 'Mentions');
+    $this->assertRaw('node-' . theme('mentions', $this->admin_user), t('[@#uid] Mention in Node was filtered.'), 'Mentions');
 
     // Check [@#uid] Mentions in Comments are filtered.
     $nid = $this->getNodeID();
     $edit = array(
       'subject' => $this->randomName(),
-      'comment' => 'comment-'. theme('mentions_input', '#'. $this->admin_user->uid, TRUE)
+      'comment' => 'comment-' . theme('mentions_input', '#' . $this->admin_user->uid, TRUE)
     );
-    $this->drupalPost('comment/reply/'. $nid, $edit, t('Save'));
-    $this->assertRaw('comment-'. theme('mentions', $this->admin_user), t('[@#uid] Mention in Comment was filtered.'), 'Mentions');
+    $this->drupalPost('comment/reply/' . $nid, $edit, t('Save'));
+    $this->assertRaw('comment-' . theme('mentions', $this->admin_user), t('[@#uid] Mention in Comment was filtered.'), 'Mentions');
 
     // Check Mentions are listed on user's Mentions page.
-    $this->drupalGet('user/'. $this->admin_user->uid .'/mentions');
+    $this->drupalGet('user/' . $this->admin_user->uid . '/mentions');
     $this->assertRaw(theme('mentions', $this->admin_user), t('Mentions are listed on user\'s Mention page.'), 'Mentions');
   }
 }
