diff --git a/format_number.info b/format_number.info
old mode 100644
new mode 100755
index 86dbd55..df7c7dc
--- a/format_number.info
+++ b/format_number.info
@@ -1,3 +1,5 @@
 name = Format Number API
 description = This module provides a method to configure number formats (site default and user defined) with configurable decimal point and thousand separators. It also exposes several functions that can be used by other contributed or custom modules to display numbers accordingly.
-core = 6.x
+core = 7.x
+
+files[] = format_number.module
diff --git a/format_number.install b/format_number.install
old mode 100644
new mode 100755
index a91734a..306391b
--- a/format_number.install
+++ b/format_number.install
@@ -1,4 +1,5 @@
 <?php
+// $Id$
 
 /**
  * @file
diff --git a/format_number.module b/format_number.module
index 9a3391b..e44660e 100644
--- a/format_number.module
+++ b/format_number.module
@@ -1,4 +1,5 @@
 <?php
+// $Id$
 
 /**
  * @file
@@ -14,28 +15,33 @@
 define('FORMAT_NUMBER_MAX_PRECISION', 8);
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function format_number_help($path, $arg) {
   switch ($path) {
     case 'admin/help#format_number':
-      return '<p>'. t('The <em>Format Number API</em> module provides a method to configure number formats (site default and user defined) with configurable decimal point and thousand separators. It also exposes several functions that can be used by other contributed or custom modules to display numbers accordingly.') .'</p>';
+      return '<p>' . t('The <em>Format Number API</em> module provides a method to configure number formats (site default and user defined) with configurable decimal point and thousand separators. It also exposes several functions that can be used by other contributed or custom modules to display numbers accordingly.') . '</p>';
   }
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_perm().
  */
-function format_number_perm() {
-  return array('configure default number format');
+function format_number_permission() {
+  return array(
+    'configure default number format' => array(
+      'title' => t('Configure default number format'),
+      //'description' => t('Modify format number global settings.'),
+    ),
+  );
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function format_number_menu() {
   $items = array();
-  $items['admin/settings/format_number'] = array(
+  $items['admin/config/regional/format_number'] = array(
     'title' => 'Number format',
     'description' => 'Configure site wide number format settings.',
     'page callback' => 'drupal_get_form',
@@ -47,28 +53,37 @@ function format_number_menu() {
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function format_number_theme() {
   return array(
-    'numericfield' => array('arguments' => array('element' => NULL)),
+    'numericfield' => array('variables' => array('element' => NULL)),
   );
 }
 
 /**
- * Implementation of hook_user().
- *
+ * Implements hook_form_user_profile_form_alter().
+ * 
  * Allows users to individually set their number format.
  */
-function format_number_user($type, &$edit, &$user, $category = NULL) {
-  if ($type == 'form' && $category == 'account' && variable_get('format_number_user_configurable', 0)) {
+function format_number_form_user_profile_form_alter(&$form, &$form_state) {
+  if ($form['#user_category'] == 'account' && variable_get('format_number_user_configurable', 0)) {
     module_load_include('inc', 'format_number', 'format_number.settings');
-    return format_number_settings_user($edit);
+    $form += format_number_settings_user($form_state['user']->data);
+    $form['#validate'][] = 'format_number_settings_user_validate';
   }
-  elseif ($type == 'validate' && $category == 'account' && variable_get('format_number_user_configurable', 0)) {
-    module_load_include('inc', 'format_number', 'format_number.settings');
-    format_number_settings_user_validate($edit);
-    return;
+}
+
+/**
+ * Implements hook_user_presave().
+ */
+function format_number_user_presave(&$edit, $account, $category) {
+  if (isset($edit['decimal_point'])) {
+    $edit['data']['decimal_point'] = $edit['decimal_point'];
+  }
+  
+  if (isset($edit['thousands_sep'])) {
+    $edit['data']['thousands_sep'] = $edit['thousands_sep'];
   }
 }
 
@@ -124,11 +139,11 @@ function format_number_get_options($name = NULL) {
       'decimal_point' => variable_get('format_number_decimal_point', '.'),
     );
     if (variable_get('format_number_user_configurable', 0) && $user->uid) {
-      if (drupal_strlen($user->thousands_sep)) {
-        $format_options['thousands_sep'] = $user->thousands_sep;
+      if (isset($user->data['thousands_sep']) && drupal_strlen($user->data['thousands_sep'])) {
+        $format_options['thousands_sep'] = $user->data['thousands_sep'];
       }
-      if (drupal_strlen($user->decimal_point)) {
-        $format_options['decimal_point'] = $user->decimal_point;
+      if (isset($user->data['decimal_point']) && drupal_strlen($user->data['decimal_point'])) {
+        $format_options['decimal_point'] = $user->data['decimal_point'];
       }
     }
   }
@@ -146,8 +161,8 @@ function format_number_add_js() {
   if (!isset($ready)) {
     $ready = TRUE;
     $module_path = drupal_get_path('module', 'format_number');
-    drupal_add_css($module_path .'/format_number.css');
-    drupal_add_js($module_path .'/format_number.js');
+    drupal_add_css($module_path . '/format_number.css');
+    drupal_add_js($module_path . '/format_number.js');
     drupal_add_js(array('format_number' => format_number_get_options()), 'setting');
   }
 }
@@ -358,9 +373,9 @@ function parse_formatted_number($formatted_number, $required = TRUE) {
 }
 
 /**
- * Implementation of hook_elements().
+ * Implements hook_element_info().
  */
-function format_number_elements() {
+function format_number_element_info() {
   return array(
     'numericfield' => array(
       '#input' => TRUE,
@@ -387,7 +402,7 @@ function format_number_elements() {
  *   The minimum or maximum possible value.
  */
 function format_number_compute_boundary($direction, $precision = 0, $decimals = 0) {
-  return (float)(($direction == 'lower' ? '-' : '') . str_repeat('9', $precision - $decimals) .'.'. str_repeat('9', $decimals));
+  return (float)(($direction == 'lower' ? '-' : '') . str_repeat('9', $precision - $decimals) . '.' . str_repeat('9', $decimals));
 }
 
 /**
@@ -555,19 +570,19 @@ function format_number_numericfield_validate($element, &$form_state) {
 function theme_numericfield($element) {
   format_number_add_js();
 
-  $size = empty($element['#size']) ? '' : ' size="'. $element['#size'] .'"';
-  $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="'. $element['#maxlength'] .'"';
+  $size = empty($element['#size']) ? '' : ' size="' . $element['#size'] . '"';
+  $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="' . $element['#maxlength'] . '"';
   $output = '';
   _form_set_class($element, array('form-numeric'));
 
   if (isset($element['#field_prefix'])) {
-    $output .= '<span class="field-prefix">'. $element['#field_prefix'] .'</span> ';
+    $output .= '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ';
   }
 
-  $output .= '<input type="text"'. $maxlength .' name="'. $element['#name'] .'" id="'. $element['#id'] .'"'. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />';
+  $output .= '<input type="text"' . $maxlength . ' name="' . $element['#name'] . '" id="' . $element['#id'] . '"' . $size . ' value="' . check_plain($element['#value']) . '"' . drupal_attributes($element['#attributes']) . ' />';
 
   if (isset($element['#field_suffix'])) {
-    $output .= ' <span class="field-suffix">'. $element['#field_suffix'] .'</span>';
+    $output .= ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>';
   }
 
   return theme('form_element', $element, $output);
diff --git a/format_number.settings.inc b/format_number.settings.inc
old mode 100644
new mode 100755
index 244d60e..57fa18a
--- a/format_number.settings.inc
+++ b/format_number.settings.inc
@@ -1,4 +1,5 @@
 <?php
+// $Id$
 
 /**
  * @file
@@ -64,14 +65,14 @@ function format_number_settings_user(&$edit) {
     '#type' => 'radios',
     '#title' => t('Decimal point'),
     '#options' => format_number_get_decimal_point_options(),
-    '#default_value' => drupal_strlen($edit['decimal_point']) ? $edit['decimal_point'] : variable_get('format_number_decimal_point', '.'),
+    '#default_value' => isset($edit['decimal_point']) && drupal_strlen($edit['decimal_point']) ? $edit['decimal_point'] : variable_get('format_number_decimal_point', '.'),
     '#description' => t('Select the character that will be used as decimal point.'),
   );
   $form['format_number']['thousands_sep'] = array(
     '#type' => 'radios',
     '#title' => t('Thousands separator'),
     '#options' => format_number_get_thousands_separator_options(),
-    '#default_value' => drupal_strlen($edit['thousands_sep']) ? $edit['thousands_sep'] : variable_get('format_number_thousands_sep', ','),
+    '#default_value' => isset($edit['thousands_sep']) && drupal_strlen($edit['thousands_sep']) ? $edit['thousands_sep'] : variable_get('format_number_thousands_sep', ','),
     '#description' => t('Select the character that will be used as thousands separator.'),
   );
   return $form;
@@ -80,7 +81,8 @@ function format_number_settings_user(&$edit) {
 /**
  * Validate the user settings form.
  */
-function format_number_settings_user_validate(&$edit) {
+function format_number_settings_user_validate($form, &$form_state) {
+  $edit = $form_state['values'];
   if (isset($edit['decimal_point']) && $edit['decimal_point'] == $edit['thousands_sep']) {
     form_set_error('thousands_sep', t('Decimal point and thousands separator cannot be defined to use the same symbol.'));
   }
