diff --git a/jquery_hotkeys.admin.inc b/jquery_hotkeys.admin.inc
index 76f1d5b..db338e8 100644
--- a/jquery_hotkeys.admin.inc
+++ b/jquery_hotkeys.admin.inc
@@ -5,40 +5,43 @@
  *
 */
 
-function theme_jquery_hotkeys_admin_form(&$form) {
+/*
+ * Render the jQuery hotkeys admin form
+ */
+function theme_jquery_hotkeys_admin_form(&$vars) {
+  $form = $vars['form'];
   $headers = array(t('Name'), t('Actions'));
   $rows = array();
+  $link = l(t('Create a new rule'), 'admin/config/user-interface/jqueryhotkeys/add');
+  
   if (!empty($form['hotkeys'])) {
     foreach (element_children($form['hotkeys']) as $jhid) {
       $row = array();
       $hotkey = $form['hotkeys'][$jhid]['#hotkey'];
-      $row[] = isset($hotkey['module']) ? $hotkey['name'] : l($hotkey['name'], 'admin/settings/jquery_hotkeys/edit/' .$hotkey['jhid']);
-      $row[] = isset($hotkey['module']) ? '-' : l(t('edit'), 'admin/settings/jquery_hotkeys/edit/' .$hotkey['jhid']);
-      $row[] = isset($hotkey['module']) ? '-' : l(t('delete'), 'admin/settings/jquery_hotkeys/delete/' .$hotkey['jhid']);
+      $row[] = l($hotkey['name'], 'admin/config/user-interface/jqueryhotkeys/' .$hotkey['jhid']);
+      $row[] = l(t('edit'), 'admin/config/user-interface/jqueryhotkeys/edit/' .$hotkey['jhid']) . ' '. l(t('delete'), 'admin/config/user-interface/jqueryhotkeys/delete/' .$hotkey['jhid']);      
       $rows[] = $row;
     }
   }
-  $link = l(t('Create a new rule'), 'admin/settings/jquery_hotkeys/add');
-  $row = array();
-  if (empty($rows)) {
-    $row[] = array(
-      'data' => t('No jQuery Hotkeys have been set up yet. !url.', array('!url' => $link)),
-      'colspan' => 3,
-    );
-  } 
-  else {
-    $row[] = array(
-      'data' => $link,
-      'colspan' => 3,
-    );
-  }
-  $rows[] = $row;
   
-  $output = theme('table', $headers, $rows);
-  $output .= drupal_render($form);
+  $vars = array(
+    'rows' => $rows,
+    'header' => $headers,
+    'attributes' => array(),
+    'colgroups' => array(),
+    'caption' => t('!url.', array('!url' => $link)),
+    'empty' => t('No jQuery Hotkeys have been set up yet.'),
+    'sticky' => false
+  );
+  
+  $output = theme_table($vars);
+  $output .= drupal_render($form['hotkeys']);
   return $output;
 }
 
+/*
+ * Callback: jquery_hotkeys_admin_form form
+ */
 function jquery_hotkeys_admin_form() {
   $hotkeys = jquery_hotkeys_load_hotkeys();
   $form = array();
@@ -49,9 +52,13 @@ function jquery_hotkeys_admin_form() {
   return $form;
 } 
 
-function jquery_hotkeys_edit($form_state, $jhid = NULL) {
+/*
+ * Callback: jquery_hotkeys_edit form
+ */
+function jquery_hotkeys_edit($form, &$form_state, $jhid = NULL) {
+  $args = func_get_args();
   $form = array();
-  if (isset($jhid)) {
+  if (is_numeric($jhid)) {
     $hotkey = jquery_hotkeys_load_hotkey($jhid);
     $form['jhid'] = array(
       '#type' => 'value',
@@ -64,7 +71,7 @@ function jquery_hotkeys_edit($form_state, $jhid = NULL) {
 
   $options = array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.'));
   $pages_description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
-  if (user_access('use PHP for hotkeys visibility')) {
+  if (user_access('use PHP for hotkeys visibility') && module_exists('php')) {
     $options[] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
     $pages_description .= ' '. t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>'));
   }
@@ -112,14 +119,20 @@ function jquery_hotkeys_edit($form_state, $jhid = NULL) {
   return $form; 
 }
 
+/*
+ * Handler: jquery_hotkeys_edit_save
+ */
 function jquery_hotkeys_edit_save($form, &$form_state) {
   $hotkey = $form_state['values'];
-  drupal_write_record('jquery_hotkeys', $hotkey, isset($hotkey['jhid']) ? 'jhid' : NULL );
+  drupal_write_record('jquery_hotkeys', $hotkey, isset($hotkey['jhid']) ? array('jhid') : array() );
   drupal_set_message(t('Hotkey changes saved.'));
-  $form_state['redirect'] = '/admin/settings/jquery_hotkeys';
+  $form_state['redirect'] = 'admin/config/user-interface/jqueryhotkeys';
 }
 
-function jquery_hotkeys_delete_confirm(&$form_state, $jhid) {
+/*
+ * Callback: jquery_hotkeys_delete_confirm
+ */
+function jquery_hotkeys_delete_confirm($form, &$form_state, $jhid) {  
   $hotkey = jquery_hotkeys_load_hotkey($jhid);
   $form = array(
     'jhid' => array(
@@ -135,12 +148,14 @@ function jquery_hotkeys_delete_confirm(&$form_state, $jhid) {
                       t('Cancel'));
 }
 
+/*
+ * Handler: jquery_hotkeys_delete_confirm
+ */
 function jquery_hotkeys_delete_confirm_submit($form, &$form_state) {
   $hotkey = jquery_hotkeys_load_hotkey($form_state['values']['jhid']);
   if ($form_state['values']['confirm']) {
-    db_query('DELETE FROM {jquery_hotkeys} where jhid = %d', $hotkey['jhid']);
+    jquery_hotkey_delete_hotkey($hotkey['jhid']);
     drupal_set_message(t('Hotkey %name deleted', array('%name' => $hotkey['name'])));
   }
-  $form_state['redirect'] = 'admin/settings/jquery_hotkeys';
+  $form_state['redirect'] = 'admin/config/user-interface/jqueryhotkeys';
 }
-
diff --git a/jquery_hotkeys.info b/jquery_hotkeys.info
index 198c1c3..78f9d53 100644
--- a/jquery_hotkeys.info
+++ b/jquery_hotkeys.info
@@ -1,4 +1,6 @@
 name = "jQuery Hotkeys"
 description = "Enables jQuery-based keyboard shortcuts for form elements."
 package = jQuery
-core = 6.x
+core = 7.x
+
+files[] = jquery.hotkeys.js
\ No newline at end of file
diff --git a/jquery_hotkeys.install b/jquery_hotkeys.install
index c607cd4..c5064a0 100644
--- a/jquery_hotkeys.install
+++ b/jquery_hotkeys.install
@@ -34,14 +34,6 @@ function jquery_hotkeys_schema() {
   return $schema;
 }
 
-function jquery_hotkeys_install() {
-  drupal_install_schema('jquery_hotkeys');
-}
-
 function jquery_hotkeys_enable() {
   drupal_set_message(t('jQuery hotkeys installed.  Please <a href="@perms">set permissions</a> and view the <a href="@settings">configuration settings</a>.', array('@perms' => url('admin/user/permissions',array('fragment' => 'module-jquery-hotkeys')), '@settings' => url('admin/settings/jquery_hotkeys'))));
-}
-
-function jquery_hotkeys_uninstall() {
-  drupal_uninstall_schema('jquery_hotkeys');
-}
+}
\ No newline at end of file
diff --git a/jquery_hotkeys.module b/jquery_hotkeys.module
index 3f332cc..c32aaf4 100644
--- a/jquery_hotkeys.module
+++ b/jquery_hotkeys.module
@@ -5,14 +5,32 @@
  *
 */
 
-
-function jquery_hotkeys_perm() {
-  return array('use jQuery hotkeys', 'administer jQuery hotkeys', 'use PHP for hotkeys visibility');
+/*
+ * Implements hook_permission().
+ */
+function jquery_hotkeys_permission() {
+  return array(
+    'use jQuery hotkeys' => array(
+      'title' => t('Use jQuery hotkeys'),
+      'description' => t('Use jQuery hotkey functionality')
+     ),
+     'administer jQuery hotkeys' => array(
+       'title' => t('Administer jQuery hotkeys'),
+       'description' => t('Add/remove/edit jQuery hotkeys')
+     ),
+     'use PHP for hotkeys visibility' => array(
+       'title' => t('Use PHP for hotkeys visibility'),
+       'description' => t('Execute PHP to determine hotkey visibility')
+     )
+   );
 }
 
+/*
+ * Implements hook_menu().
+ */
 function jquery_hotkeys_menu() {
   $items = array(
-  'admin/settings/jquery_hotkeys' => array(
+  'admin/config/user-interface/jqueryhotkeys' => array(
     'title' => 'jQuery Hotkeys',
     'description' => 'Add generic JavaScript to pages based on hotkeys.',
     'page callback' => 'drupal_get_form',
@@ -20,15 +38,15 @@ function jquery_hotkeys_menu() {
     'access arguments' => array('administer jquery hotkeys'),
     'file' => 'jquery_hotkeys.admin.inc'
     ),
-  'admin/settings/jquery_hotkeys/edit' => array(
+  'admin/config/user-interface/jqueryhotkeys/edit/%' => array(
     'title' => 'Edit jQuery Hotkey',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('jquery_hotkeys_edit'),
+    'page arguments' => array('jquery_hotkeys_edit', 5),
     'access arguments' => array('administer jquery hotkeys'),
     'file' => 'jquery_hotkeys.admin.inc',
     'type' => MENU_CALLBACK,
     ),
-  'admin/settings/jquery_hotkeys/add' => array(
+  'admin/config/user-interface/jqueryhotkeys/add' => array(
     'title' => 'Add jQuery Hotkey',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('jquery_hotkeys_edit'),
@@ -36,10 +54,10 @@ function jquery_hotkeys_menu() {
     'type' => MENU_CALLBACK,
     'file' => 'jquery_hotkeys.admin.inc'
     ),
-  'admin/settings/jquery_hotkeys/delete' => array(
+  'admin/config/user-interface/jqueryhotkeys/delete/%' => array(
     'title' => 'Delete jQuery Hotkey',
     'page callback' => 'drupal_get_form',
-    'page arguments' => array('jquery_hotkeys_delete_confirm'),
+    'page arguments' => array('jquery_hotkeys_delete_confirm', 5),
     'access arguments' => array('administer jquery hotkeys'),
     'type' => MENU_CALLBACK,
     'file' => 'jquery_hotkeys.admin.inc'
@@ -48,6 +66,9 @@ function jquery_hotkeys_menu() {
   return $items;
 }
 
+/*
+ * Implements hook_init().
+ */
 function jquery_hotkeys_init() {
   if (!(user_access('use jquery hotkeys'))) {
     return;
@@ -68,7 +89,7 @@ function jquery_hotkeys_init() {
             $page_match = !($hotkey['visibility'] xor $page_match);
           }
         else {
-          $page_match = drupal_eval($hotkey['pages']);
+          $page_match = php_eval($hotkey['pages']);
         }
       } 
       else {
@@ -82,32 +103,85 @@ function jquery_hotkeys_init() {
   }
 }
 
+/**
+ * Register javascript functionality provided by a hotkey
+ * 
+ * @param array $hotkey 
+ *  Hotkey db record
+ *  @see jquery_hotkeys_load_hotkey()
+ */
 function jquery_hotkeys_apply_hotkey($hotkey) {
-  drupal_add_js(drupal_get_path('module', 'jquery_hotkeys') .'/jquery.hotkeys.js', 'module');
-  $js = 'if (Drupal.jsEnabled) { $(document).ready(function() {';
-  $js .= "$(document).bind('keydown','" .$hotkey['hotkey'] ."',function(evt) { ";
-  $js .= $hotkey['javascript'] .";return false; });})};";
+  drupal_add_js(drupal_get_path('module', 'jquery_hotkeys') . '/jquery.hotkeys.js');
+  $js = 'jQuery(document).ready(function() {';
+  $js .= "jQuery('html').bind('keydown','" . $hotkey['hotkey'] ."',function(evt) { ";
+  $js .= $hotkey['javascript'] .";});});";
   drupal_add_js($js, 'inline');
 }
 
-function jquery_hotkeys_load_hotkey($jhid) {
-  return db_fetch_array(db_query("SELECT * FROM {jquery_hotkeys} WHERE jhid=%d", $jhid));
-}
-
+/**
+ * Load all defined hotkeys
+ * 
+ * @return array
+ *  List of hotkey records
+ *  @see jquery_hotkeys_load_hotkey().
+ */
 function jquery_hotkeys_load_hotkeys() {
   $hotkeys = array();
-  $result = db_query("SELECT * FROM {jquery_hotkeys}");
-  while ($hotkey = db_fetch_array($result)) {
+  $result = db_select('jquery_hotkeys', 'j')
+             ->fields('j')
+             ->execute();    
+  
+  while ($hotkey = $result->fetchAssoc()){
     $hotkeys[] = $hotkey;
   }
+  
   drupal_alter('jquery_hotkeys', $hotkeys);
   return $hotkeys;
 }
 
+/**
+ * Load a hotkey by id
+ * 
+ * @param int $jhid
+ *  Hotkey id
+ * 
+ * @return array 
+ *  Hotkey database record provided by fetchAssoc()
+ */
+function jquery_hotkeys_load_hotkey($jhid){
+  $hotkey = array();
+  $result = db_select('jquery_hotkeys', 'j')
+           ->fields('j')
+           ->condition('j.jhid', $jhid)    
+           ->execute()       
+           ->fetchAssoc();
+  
+  if (is_array($result)){
+    $hotkey = $result;
+  }
+  
+  return $hotkey;
+}
+
+/**
+ * Delete a hotkey by id
+ * 
+ * @param int $jhid 
+ *  Hotkey id
+ */
+function jquery_hotkey_delete_hotkey($jhid){
+  db_delete('jquery_hotkeys')
+  ->condition('jhid', $jhid)
+  ->execute();
+}
+
+/*
+ * Implements hook_theme().
+ */
 function jquery_hotkeys_theme() {
   $items['jquery_hotkeys_admin_form'] = array(
-    'arguments' => array('form' => array()),
+    'render element' => 'form',
+    'file' => 'jquery_hotkeys.admin.inc'
   );
   return $items;
 }
-
