diff --git a/feed_path_publisher.info b/feed_path_publisher.info
index d622347..1c1370e 100644
--- a/feed_path_publisher.info
+++ b/feed_path_publisher.info
@@ -1,4 +1,7 @@
 name = Feed Path Publisher
 description = Publishes RSS feeds sitewide and to specific paths.
-core = 6.x
+core = 7.x
 
+
+files[] = feed_path_publisher.install
+files[] = feed_path_publisher.module
diff --git a/feed_path_publisher.install b/feed_path_publisher.install
index 842cf72..13a4283 100644
--- a/feed_path_publisher.install
+++ b/feed_path_publisher.install
@@ -1,53 +1,120 @@
 <?php
+/**
+ * @file
+ * Install, update and uninstall functions for the feed_path_publisher module.
+ *
+ */
 
+
+/**
+ * Implements hook_schema().
+ */
 function feed_path_publisher_schema() {
   $schema['feed_path_publisher'] = array(
-      'fields' => array(
-           'fppid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
-           'title' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
-           'path_prefix' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
-           'feed' => array('type' => 'varchar', 'length' => '200', 'not null' => TRUE),
-           'weight' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11')),
-      'primary key' => array('fppid'),
-      'unique keys' => array(
-           'path_prefix' => array('path_prefix', 'feed')),
-      'indexes' => array(
-           'listing' => array('weight', 'path_prefix', 'title')),
+    'fields' => array(
+      'fppid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'disp-width' => '10',
+      ),
+      'title' => array(
+        'type' => 'varchar',
+        'length' => '50',
+        'not null' => TRUE,
+      ),
+      'path_prefix' => array(
+        'type' => 'varchar',
+        'length' => '100',
+        'not null' => TRUE,
+      ),
+      'feed' => array(
+        'type' => 'varchar',
+        'length' => '200',
+        'not null' => TRUE,
+      ),
+      'weight' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'disp-width' => '11',
+      ),
+    ),
+    'primary key' => array('fppid'),
+    'unique keys' => array(
+      'path_prefix' => array('path_prefix', 'feed'),
+    ),
+    'indexes' => array(
+      'listing' => array('weight', 'path_prefix', 'title'),
+    ),
   );
-  
+
   $schema['feed_path_publisher_roles'] = array(
     'fields' => array(
-         'fpprid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
-         'fppid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
-         'show_hide' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
-         'rids' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE)),
+      'fpprid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'disp-width' => '10',
+      ),
+      'fppid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'disp-width' => '10',
+      ),
+      'show_hide' => array(
+        'type' => 'varchar',
+        'length' => '50',
+        'not null' => TRUE,
+      ),
+      'rids' => array(
+        'type' => 'varchar',
+        'length' => '100',
+        'not null' => TRUE,
+      ),
+    ),
     'primary key' => array('fpprid'),
   );
 
   return $schema;
 }
 
-function feed_path_publisher_install() {
-  drupal_install_schema('feed_path_publisher');
-}
-
-function feed_path_publisher_uninstall() {
-  drupal_uninstall_schema('feed_path_publisher');
-}
-
 
+/**
+ * Implements hook_update_N().
+ * Create feed_path_publisher_roles table.
+ */
 function feed_path_publisher_update_1() {
   $schema['feed_path_publisher_roles'] = array(
     'fields' => array(
-         'fpprid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
-         'fppid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
-         'show_hide' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
-         'rids' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE)),
+      'fpprid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'disp-width' => '10',
+      ),
+      'fppid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'disp-width' => '10',
+      ),
+      'show_hide' => array(
+        'type' => 'varchar',
+        'length' => '50',
+        'not null' => TRUE,
+      ),
+      'rids' => array(
+        'type' => 'varchar',
+        'length' => '100',
+        'not null' => TRUE,
+      ),
+    ),
     'primary key' => array('fpprid'),
   );
 
   $ret = array();
-  db_create_table($ret, 'feed_path_publisher_roles', $schema['feed_path_publisher_roles']);
-  return $ret;
+  db_create_table('feed_path_publisher_roles', $schema['feed_path_publisher_roles']);
+  return t('Created feed_path_publisher_roles table.');
 }
 
diff --git a/feed_path_publisher.module b/feed_path_publisher.module
index 2ad89b0..645d08b 100644
--- a/feed_path_publisher.module
+++ b/feed_path_publisher.module
@@ -1,91 +1,124 @@
 <?php
 
+/**
+ * Implements hook_menu().
+ */
 function feed_path_publisher_menu() {
   $items = array();
 
-  $items['admin/content/feed_path_publisher'] = array(
-    'title' => 'Feed path publisher',
+  $items['admin/config/content/feed_path_publisher'] = array(
+    'title' => 'Feed Path Publisher',
+    'description' => 'Settings for feeds across the site.',
     'page callback' => 'feed_path_publisher_list',
     'access arguments' => array('administer site configuration'),
+    'type' => MENU_NORMAL_ITEM,
   );
-  
-  $items['admin/content/feed_path_publisher/list'] = array(
+
+  $items['admin/config/content/feed_path_publisher/list'] = array(
     'title' => 'List',
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight' => -1,
     'access arguments' => array('administer site configuration'),
   );
 
-  $items['admin/content/feed_path_publisher/add'] = array(
+  $items['admin/config/content/feed_path_publisher/add'] = array(
     'title' => 'Add',
     'type' => MENU_LOCAL_TASK,
     'page callback' => 'feed_path_publisher_add',
     'access arguments' => array('administer site configuration'),
   );
 
-  $items['admin/content/feed_path_publisher/%/edit'] = array(
-      'page callback' => 'feed_path_publisher_edit',
-      'page arguments' => array(3),
-      'access arguments' => array('administer site configuration'),
+  $items['admin/config/content/feed_path_publisher/%/edit'] = array(
+    'page callback' => 'feed_path_publisher_edit',
+    'page arguments' => array(4),
+    'access arguments' => array('administer site configuration'),
   );
 
   return $items;
 }
 
 
+/**
+ * Implements hook_init().
+ */
 function feed_path_publisher_init() {
   _feed_path_publisher_add_feeds($_GET['q']);
 }
 
 function _feed_path_publisher_add_feeds($internal_path) {
   global $user;
-  
+
   $aliased_path = $internal_path;
   $front_page_path = $internal_path;
-  
+
   // Add feeds based on aliased paths
   if (module_exists('path')) {
     $aliased_path = drupal_get_path_alias($internal_path);
   }
-  
+
   if (drupal_is_front_page()) {
     $front_page_path = '<front>';
   }
 
-  $res = db_query('SELECT title, feed, fppid FROM {feed_path_publisher} WHERE path_prefix = LEFT("%s", LENGTH(path_prefix)) OR path_prefix = LEFT("%s", LENGTH(path_prefix)) OR path_prefix = LEFT("%s", LENGTH(path_prefix)) ORDER BY weight, path_prefix', $internal_path, $aliased_path, $front_page_path);
+  $res = db_query('SELECT title, feed, fppid
+    FROM {feed_path_publisher}
+    WHERE path_prefix = LEFT(:internal_path,  LENGTH(path_prefix))
+      OR path_prefix = LEFT(:aliased_path, LENGTH(path_prefix)) 
+      OR path_prefix = LEFT(:front_page_path, LENGTH(path_prefix)) 
+    ORDER BY weight, path_prefix', 
+    array(
+      ':internal_path' => $internal_path,
+      ':aliased_path' => $aliased_path,
+      ':front_page_path' => $front_page_path,
+    ));
+
+  foreach ($res as $row) {
+    $path_rids = db_select('feed_path_publisher_roles', 'fppr')
+      ->fields('fppr', array('rids'))
+      ->condition('fppid', $row->fppid)
+      ->execute()
+      ->fetchField();
+    $path_rids = explode(',', $path_rids);
 
-  while ($row = db_fetch_object($res)) {
-    $path_rids = '';
-    $path_rids = db_result(db_query('SELECT rids FROM {feed_path_publisher_roles} WHERE fppid = %d', $row->fppid));
-    $path_rids = explode(',',$path_rids);
-    
     if ($path_rids) {
-      $show_hide = db_result(db_query('SELECT show_hide FROM {feed_path_publisher_roles} WHERE fppid = %d', $row->fppid));
+      $show_hide = db_select('feed_path_publisher_roles', 'fppr')
+        ->fields('fppr', array('show_hide'))
+        ->condition('fppid', $row->fppid)
+        ->execute()
+        ->fetchField();
       $role_found = false;
 
-      foreach($user->roles as $key => $value) {
+      foreach ($user->roles as $key => $value) {
         if (in_array($key, $path_rids)) {
           $role_found = true;
         }
       }
-      
+
       if ((!$role_found && $show_hide == 'show') || ($role_found && $show_hide == 'hide')) {
         continue;
       }
     }
-    
-    drupal_add_link(array('rel' => 'alternate',
-                          'type' => 'application/rss+xml',
-                          'title' => $row->title,
-                          'href' => url($row->feed))); 	
+
+    drupal_add_feed(url($row->feed), $row->title);
   }
 }
 
+
+/**
+ * Menu callback for admin/config/content/feed_path_publisher/list
+ * 
+ * Displays the list of feeds
+ */
 function feed_path_publisher_list() {
   drupal_set_title('Feed path publisher');
 
-  $res = db_query('SELECT * FROM {feed_path_publisher} ORDER BY weight, path_prefix, title');
-  
+  $result = db_select('feed_path_publisher', 'fpp')
+    ->fields('fpp')
+    ->orderBy('weight')
+    ->orderBy('path_prefix')
+    ->orderBy('title')
+    ->execute();
+
   $cols = array(
     'Title',
     'Path Prefix',
@@ -93,15 +126,14 @@ function feed_path_publisher_list() {
     'Weight',
     'Operations',
   );
-  
+
   $rows = array();
-  while ($row = db_fetch_object($res)) {
+  while($row = $result->fetchObject()) {
     $ops = array();
-    $ops[] = l('edit', 'admin/content/feed_path_publisher/' . $row->fppid . '/edit');
-    //$ops[] = l('delete', 'admin/content/feed_path_publisher/' . $row->fppid . '/delete');
-    
+    $ops[] = l('edit', 'admin/config/content/feed_path_publisher/' . $row->fppid . '/edit');
+
     $path_prefix = $row->path_prefix;
-    
+
     $rows[] = array(
       check_plain($row->title),
       ($row->path_prefix == '' ? '<em>Global</em>' : check_plain($path_prefix)),
@@ -111,20 +143,33 @@ function feed_path_publisher_list() {
     );
   }
 
-  $content = theme('table', $cols, $rows);
+  $content = theme('table', array('header' => $cols, 'rows' => $rows));
 
   return $content;
 }
 
+/**
+ * Page callback for admin/config/content/feed_path_publisher/add
+ * 
+ * Displays feed add form.
+ */
 function feed_path_publisher_add() {
   return drupal_get_form('feed_path_publisher_edit_form');
 }
 
+/**
+ * Page callback for admin/config/content/feed_path_publisher/%/edit
+ * 
+ * Edit form to modify a feed
+ */
 function feed_path_publisher_edit($fppid) {
   return drupal_get_form('feed_path_publisher_edit_form', $fppid);
 }
 
-function feed_path_publisher_edit_form($unknown = NULL, $fppid = NULL) {
+/**
+ * Form to edit feed.
+ */
+function feed_path_publisher_edit_form($form, $unknown = NULL, $fppid = NULL) {
   $form = array();
 
   $use_roles = false;
@@ -132,19 +177,42 @@ function feed_path_publisher_edit_form($unknown = NULL, $fppid = NULL) {
   $checked_roles = array();
   $item = (object) NULL;
   if (isset($fppid)) {
-    $item = db_fetch_object(db_query('SELECT * FROM {feed_path_publisher} WHERE fppid = %d', $fppid));
-    if(db_result(db_query('SELECT count(*) FROM {feed_path_publisher_roles} WHERE fppid = %d', $fppid)) > 0) {
+    $item = db_select('feed_path_publisher', 'fpp')
+      ->fields('fpp')
+      ->condition('fppid', $fppid)
+      ->execute()
+      ->fetchObject();
+    
+    $item_count = db_select('feed_path_publisher_roles', 'fppr')
+      ->fields('fppr', array('fppid'))
+      ->condition('fppid', $fppid)
+      ->execute()
+      ->rowCount();
+    
+    if ($item_count > 0) {
       $use_roles = true;
-      if(db_result(db_query('SELECT show_hide FROM {feed_path_publisher_roles} WHERE fppid = %d limit 1', $fppid)) == 'show' ) {
+      
+      $showhide = db_select('feed_path_publisher_roles', 'fppr')
+        ->fields('fppr', array('show_hide'))
+        ->condition('fppid', $fppid)
+        ->execute()
+        ->fetchField();
+        
+      if ($showhide == 'show' ) {
         $show_hide = 0;
       }
       else {
         $show_hide = 1;
       }
-      
-      $checked_roles = explode(',',db_result(db_query('SELECT rids FROM {feed_path_publisher_roles} where fppid = %d' . $fppid)));
+
+      $rids = db_select('feed_path_publisher_roles', 'fppr')
+        ->fields('fppr', 'rids')
+        ->condition('fppid', $fppid)
+        ->execute()
+        ->fetchField();
+      $checked_roles = explode(',', $rids);
     }
-    
+
     $form['fppid'] = array(
       '#type' => 'hidden',
       '#value' => $item->fppid,
@@ -157,7 +225,7 @@ function feed_path_publisher_edit_form($unknown = NULL, $fppid = NULL) {
     '#default_value' => $item->title,
     '#required' => TRUE,
   );
-  
+
   $form['path_prefix'] = array(
     '#type' => 'textfield',
     '#title' => t('Path prefix'),
@@ -172,14 +240,14 @@ function feed_path_publisher_edit_form($unknown = NULL, $fppid = NULL) {
     '#required' => TRUE,
     '#description' => t('Relative paths should not begin with a slash.'),
   );
-  
+
   $form['weight'] = array(
     '#type' => 'weight',
     '#title' => t('Weight'),
     '#default_value' => $item->weight,
     '#description' => t('Optional. In the feed listings, the heavier items will sink and the lighter items will be positioned nearer the top.'),
   );
-  
+
   $form['roles'] = array(
     '#type' => 'fieldset',
     '#title' => t('Role-based feed publishing'),
@@ -196,11 +264,11 @@ function feed_path_publisher_edit_form($unknown = NULL, $fppid = NULL) {
     '#type' => 'radios',
     '#title' => t('Behavior'),
     '#default_value' => $show_hide,
-    '#options' => array( t('Show this feed for the following roles'), t('Hide this feed for the following roles')),
+    '#options' => array(t('Show this feed for the following roles'), t('Hide this feed for the following roles')),
   );
-  $roles = db_query('SELECT * FROM {role}');
-  
-  while($role = db_fetch_object($roles)) {
+  $roles = db_select('role', 'role')->fields('role')->execute();
+
+  while ($role = $roles->fetchObject()) {
     $options[$role->rid] = $role->name;
   }
 
@@ -210,28 +278,31 @@ function feed_path_publisher_edit_form($unknown = NULL, $fppid = NULL) {
     '#default_value' => $checked_roles,
     '#options' => $options,
   );
-  
+
   $form[] = array(
     '#type' => 'submit',
     '#value' => t('Save'),
   );
-  
+
   if (isset($fppid)) {
     $form[] = array(
       '#type' => 'submit',
       '#value' => t('Delete'),
     );
   }
-  
+
   return $form;
 }
 
+/**
+ * Submit handler for feed_path_publisher_edit_form
+ */
 function feed_path_publisher_edit_form_submit($form, &$form_state) {
   $rids = array();
-  foreach($form_state['values']['roles_list'] as $role => $value) {
-    if($value) {
+  foreach ($form_state['values']['roles_list'] as $role => $value) {
+    if ($value) {
       $rids[] = $role;
-     }
+    }
   }
   $show_hide = '';
   if ($form_state['values']['show_hide'] == 1) {
@@ -240,45 +311,83 @@ function feed_path_publisher_edit_form_submit($form, &$form_state) {
   else {
     $show_hide = 'show';
   }
-  
+
   if (isset($form_state['values']['fppid'])) {
     if ($form_state['values']['op'] == t('Delete')) {
-      db_query('DELETE FROM {feed_path_publisher} WHERE fppid = %d', $form_state['values']['fppid']);
-      db_query('DELETE FROM {feed_path_publisher_roles} WHERE fppid = %d', $form_state['values']['fppid']);
+      db_delete('feed_path_publisher')
+        ->condition('fppid', $form_state['values']['fppid'])
+        ->execute();
+      db_delete('feed_path_publisher_roles')
+        ->condition('fppid', $form_state['values']['fppid'])
+        ->execute();
       drupal_set_message(t('Feed path deleted.'));
     }
     else {
-      db_query('UPDATE {feed_path_publisher} SET title = "%s", path_prefix = "%s", feed = "%s", weight = %d WHERE fppid = %d', $form_state['values']['title'], $form_state['values']['path_prefix'], $form_state['values']['feed'], $form_state['values']['weight'], $form_state['values']['fppid']);
+      db_update('feed_path_publisher')
+        ->fields(array(
+          'title' => $form_state['values']['title'],
+          'path_prefix' => $form_state['values']['path_prefix'],
+          'feed' => $form_state['values']['feed'],
+          'weight' => $form_state['values']['weight'],
+        ))
+        ->condition('fppid', $form_state['values']['fppid'])
+        ->execute();
       if ($form_state['values']['enable_roles'] == 1) {
-        $rids = implode(',',$rids);
-        $id = db_result(db_query('select fpprid  from {feed_path_publisher_roles} WHERE fppid = %d', $form_state['values']['fppid']));
+        $rids = implode(',', $rids);
+        $id = db_query('select fpprid  from {feed_path_publisher_roles} WHERE fppid = %d', $form_state['values']['fppid'])->fetchField();
         if ($id) {
-          db_query('UPDATE {feed_path_publisher_roles} SET show_hide = "%s", rids = "%s" WHERE fpprid = %d', $show_hide, $rids, $id);
+          db_update('feed_path_publisher_roles')
+            ->fields(array(
+              'show_hide' => $show_hide,
+              'rids' => $rids,
+            ))
+            ->condition('fpprid', $id)
+            ->execute();
         }
         else {
-          db_query('INSERT INTO {feed_path_publisher_roles} (fppid,show_hide,rids) VALUES (%d, "%s", "%s")', $form_state['values']['fppid'], $show_hide, $rids);
+          $id = db_insert('feed_path_publisher_roles')
+            ->fields(array(
+              'fppid' => $form_state['values']['fppid'],
+              'show_hide' => $show_hide,
+              'rids' => $rids,
+            ))
+            ->execute();
         }
       }
       else {
-        db_query('DELETE FROM {feed_path_publisher_roles} WHERE fppid = %d', $form_state['values']['fppid']);
+        db_delete('feed_path_publisher_roles')
+          ->condition('fppid', $form_state['values']['fppid'])
+          ->execute();
       }
       drupal_set_message(t('Feed path updated.'));
     }
   }
   else {
-    db_query('INSERT INTO {feed_path_publisher} (title, path_prefix, feed, weight) VALUES ("%s", "%s", "%s", %d)', $form_state['values']['title'], $form_state['values']['path_prefix'], $form_state['values']['feed'], $form_state['values']['weight']);
+    $id = db_insert('feed_path_publisher')
+      ->fields(array(
+        'title' => $form_state['values']['title'],
+        'path_prefix' => $form_state['values']['path_prefix'],
+        'feed' => $form_state['values']['feed'],
+        'weight' => $form_state['values']['weight'],
+      ))
+      ->execute();
 
     if ($form_state['values']['enable_roles'] == 1) {
-      $fppid = db_result(db_query("select last_insert_id()"));
+      $fppid = db_query("select last_insert_id()")->fetchField();
       if ($rids) {
-        $rids = implode(',',$rids);
-        db_query('INSERT INTO {feed_path_publisher_roles} (fppid,show_hide,rids) VALUES (%d, "%s", "%s")', $fppid, $show_hide, $rids);
+        $rids = implode(',', $rids);
+        $id = db_insert('feed_path_publisher_roles')
+          ->fields(array(
+            'fppid' => $fppid,
+            'show_hide' => $show_hide,
+            'rids' => $rids,
+          ))
+          ->execute();
       }
     }
 
     drupal_set_message(t('Feed path created.'));
   }
-  
-  $form_state['redirect'] = 'admin/content/feed_path_publisher';
-}
 
+  $form_state['redirect'] = 'admin/config/content/feed_path_publisher';
+}
\ No newline at end of file
