diff --git a/library.admin.inc b/library.admin.inc
index ceab47f..b3d7095 100644
--- a/library.admin.inc
+++ b/library.admin.inc
@@ -138,6 +138,48 @@ function library_admin_settings() {
     '#size' => 20,
     '#maxlength' => 20,
   );
+
+  if (module_exists('content_profile')) {
+    $form['library_content_profile'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('content profile for library actions'),
+      '#description' => t('select these fields to be queried when you are querying for a patron.'),
+    );
+    $f=db_query("select field_name,label from {content_node_field_instance} where type_name='profile' and widget_module='text'");
+    while ($i=db_fetch_object($f)) {
+      $form['library_content_profile']['library_content_profile_' . $i->field_name] = array(
+        '#type' => 'checkbox',
+        '#title' => t($i->label . ' (' . $i->field_name . ')'),
+        '#default_value' => variable_get('library_content_profile_' . $i->field_name, 0),
+      );
+    }
+    $form['library_content_profile']['library_content_profile_nodetitle'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('node title field'),
+      '#default_value' => variable_get('library_content_profile_nodetitle', 0),
+    );
+  }
+
+  if (module_exists('profile')) {
+    $form['library_profile'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('profile for library actions'),
+      '#description' => t('select these fields to be queried when you are querying for a patron.'),
+    );
+    $f=db_query("select title,name from {profile_fields} where type='textfield'");
+    while ($i=db_fetch_object($f)) {
+      $form['library_profile']['library_profile_' . $i->name] = array(
+        '#type' => 'checkbox',
+        '#title' => t($i->title . ' (' . $i->name . ')'),
+        '#default_value' => variable_get('library_profile_' . $i->name, 0),
+      );
+    }
+  }
+
+  if (module_exists('profile') && module_exists('content_profile')) {
+    drupal_set_message(t('You have the Profile module and the Content Profile module activated. This is not supported by the library module!'), 'error');
+  }
+
   return system_settings_form($form);
 }
 
diff --git a/library.info b/library.info
index 2b5f738..e5c5a34 100644
--- a/library.info
+++ b/library.info
@@ -1,7 +1,6 @@
-; $Id: library.info,v 1.4 2008/09/12 20:25:01 jastraat Exp $
+; $Id: library.info,v 1.1.2.1.2.2 2008/09/12 20:21:08 jastraat Exp $
 name 		= "Library"
 description 	= "Include content types in a library. CCK, Trigger, and Views are recommended."
-dependencies[] = patron
 package 	= Library
 core 		= "6.x"
 
diff --git a/library.install b/library.install
index 1aa8086..b28aff2 100644
--- a/library.install
+++ b/library.install
@@ -73,7 +72,7 @@ function library_schema() {
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE),
-      'patron_id' => array(
+      'uid' => array(
         'description' => t('The associated customer.'),
         'type' => 'int',
         'unsigned' => TRUE,
@@ -102,12 +101,12 @@ function library_schema() {
     ),
     'indexes' => array(
       'item_id'     => array('item_id'),
-      'patron_id'     => array('patron_id'),
+      'uid'     => array('uid'),
       'action_aid'  => array('action_aid'),
       ),
     'primary key' => array('tid'),
     );
- $schema['library_actions'] = array(
+  $schema['library_actions'] = array(
     'description' => t('The table where library transactions are stored.'),
     'fields' => array(
       'aid' => array(
@@ -191,6 +190,48 @@ function library_uninstall() {
   cache_clear_all(null, 'cache_menu');
   cache_clear_all(null, 'cache_page');
 
-  drupal_set_message(t('Library module successfully uninstalled'));
+  drupal_set_message(st('Library module successfully uninstalled'));
 }
 
+
+function library_update_6201() {
+  if (module_exists('patron')) {
+    if (variable_get('patron_is_user', FALSE)) {
+      $items = array();
+      $items[] = update_sql("UPDATE {library_transactions} lt JOIN {library_patrons} lp on lt.patron_id=lp.nid SET lt.patron_id=lp.patron_uid");
+      $items[] = update_sql("ALTER TABLE {library_transactions} CHANGE patron_id  uid int(10)");
+      drupal_set_message(st('The table library_patrons is not removed on purpose, to give you the option of migrating over name or ID fields.', 'warning'));
+      return $items;
+    }
+    else {
+      drupal_set_message(st('We cannot automatically update your library module. You have to convert your patrons to users by hand.'), 'error');
+    }
+  }
+}
+
+function library_update_6202() {
+//Copied from patron/patron.install and added dropping the library_patrons table
+  variable_del('patron_is_user');
+  variable_del('patron_use_barcodes');
+  variable_del('patron_autocreate');
+
+  $result = db_query("SELECT nid FROM {node} WHERE type = 'patron'");
+
+  if ($result) {
+    while ($row = db_fetch_object($result)) {
+      set_time_limit(5);
+      node_delete($row->nid);
+    }
+  }
+
+  drupal_uninstall_schema('patron');
+  db_query("DROP TABLE {library_patrons}");
+
+  // Clear the cache tables.
+  cache_clear_all(null, 'cache');
+  cache_clear_all(null, 'cache_filter');
+  cache_clear_all(null, 'cache_menu');
+  cache_clear_all(null, 'cache_page');
+
+  drupal_set_message(t('Library patron module successfully uninstalled'));
+}
diff --git a/library.module b/library.module
index 17bc31c..c005643 100644
--- a/library.module
+++ b/library.module
@@ -68,13 +68,14 @@ define('LIBRARY_ACTION_TYPE_AVAILABLE', 2);
 define('LIBRARY_RESULTS_PER_PAGE', 50);
 
 /**
-* Valid permissions for this module
-* @return array An array of valid permissions for this module
-*/
+ * Valid permissions for this module
+ * @return array An array of valid permissions for this module
+ */
 function library_perm() {
   $permissions = array(
-    'administer library', 
+    'administer library',
     'administer transactions',
+    'search library patrons',
     'view library history',
     'view own library history',
   );
@@ -84,25 +85,14 @@ function library_perm() {
   return $permissions;
 }
 
-/* 
+/*
  * Determine whether a user may perform any library action
  */
 function library_action_access($aid) {
-  $may_view_patron = FALSE;
-  if (user_access('view patron content')) {
-    $may_view_patron = TRUE;
-  }
-  else {
-    global $user;
-    $user_patron = patron_load_by_uid($user->uid);
-    if (is_object($user_patron)) {
-      $may_view_patron = TRUE;
-    }
-  }
-  if (user_access('administer transactions') && $may_view_patron) {
+  if (user_access('administer transactions')) {
     return TRUE;
   }
-  elseif ($aid && $may_view_patron) {
+  elseif ($aid) {
     $action = library_get_action($aid);
     if ($action->name) {
       return user_access('submit library '. $action->name);
@@ -111,14 +101,14 @@ function library_action_access($aid) {
   return FALSE;
 }
 
-function library_history_access($node) {
+function library_history_user_access() {
   if (user_access('view library history')) {
     return TRUE;
   }
   elseif (user_access('view own library history')) {
     global $user;
-    $user_patron = patron_load_by_uid($user->uid);
-    if (is_object($user_patron) && $user_patron->nid == $node->nid) {
+    $user_page=user_load(arg(1));
+    if (is_object($user_page) && $user_page->uid == $user->uid) {
       return TRUE;
     }
   }
@@ -450,7 +440,7 @@ function library_load($item_id) {
     if ($item->in_circulation == LIBRARY_CIRCULATION && $item->library_status == LIBRARY_ITEM_UNAVAILABLE) {
       $last = library_get_last_transaction_by_item($item, LIBRARY_ACTION_TYPE_UNAVAILABLE);
       if ($last) {
-        $item->last_patron_id = $last->patron_id;
+        $item->last_patron_id = $last->uid;
         $item->last_transaction_id = $last->tid;
         $item->last_transaction_name = $last->action_name;
         if (!empty($last->duedate)) {
@@ -477,8 +467,16 @@ function library_menu() {
     'title' => 'History',
     'page callback' => 'library_history',
     'page arguments' => array(1),
-    'access callback' => 'library_history_access',
-    'access arguments' => array(1),
+    'access arguments' => array('view library history'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 2,
+    'file' => 'library.pages.inc',
+  );
+  $items['user/%user/library/history'] = array(
+    'title' => 'History',
+    'page callback' => 'library_history',
+    'page arguments' => array(1),
+    'access callback' => 'library_history_user_access',
     'type' => MENU_LOCAL_TASK,
     'weight' => 2,
     'file' => 'library.pages.inc',
@@ -572,6 +570,12 @@ function library_menu() {
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
+  $items['patrons/autocomplete'] = array(
+    'title' => 'Patron Autocomplete',
+    'page callback' => 'library_patron_autocomplete',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK
+  );
   return $items;
 }

@@ -928,18 +933,18 @@ function library_item_in_library($node = NULL, $item_id = NULL) {

 /**
  * Returns a list of overdue library items
- */ 
+ */
 function library_get_overdue_items() {
   //Select all the nodes that have ever had an item made unavailable
-  $items = db_query("SELECT id FROM {library} WHERE library_status = %d", LIBRARY_ITEM_UNAVAILABLE); 
+  $items = db_query("SELECT id FROM {library} WHERE library_status = %d", LIBRARY_ITEM_UNAVAILABLE);
   $overdueitems = array();
   while ($result = db_fetch_object($items)) {
     $item = library_load($result->id);
     if (!empty($item->last_patron_id) && !empty($item->last_due_date) && (time() > $item->last_due_date)) {
-      $patron = node_load($item->last_patron_id);
+      $patron = user_load($item->last_patron_id);
       if (!isset($overdueitems[$item->last_patron_id]['patron']['patron_email'])) {
-        $overdueitems[$item->last_patron_id]['patron']['patron_email'] = $patron->email;
-        $overdueitems[$item->last_patron_id]['patron']['patron_name'] = $patron->name_first .' '. $patron->name_last;
+        $overdueitems[$item->last_patron_id]['patron']['patron_email'] = $patron->mail;
+        $overdueitems[$item->last_patron_id]['patron']['patron_name'] = $patron->name;
       }
       $overdueitems[$item->last_patron_id]['items'][$item->id] = array('item_name' => $item->title, 'nid' => $item->nid, 'due_date' => $item->last_due_date, 'in_circulation' => $item->in_circulation);
     }
@@ -999,10 +1004,10 @@ function library_duedates_enabled($type = NULL) {
 }
 
 function library_get_transactions_by_item($item) {
-  $result = db_query('SELECT lt.created, lt.tid, la.aid, la.name as "action_name", 
-                      la.status_change, lt.patron_id, lt.item_id, lt.duedate, lt.notes, l.in_circulation, l.barcode, n.title as "item_name", n.nid
-                      FROM {library_transactions} lt, {library_actions} la, {library} l, {node} n 
-                      WHERE la.aid = lt.action_aid AND n.nid = l.nid AND lt.item_id = l.id AND l.id = %d 
+  $result = db_query('SELECT lt.created, lt.tid, la.aid, la.name as "action_name",
+                      la.status_change, lt.uid, lt.item_id, lt.duedate, lt.notes, l.in_circulation, l.barcode, n.title as "item_name", n.nid
+                      FROM {library_transactions} lt, {library_actions} la, {library} l, {node} n
+                      WHERE la.aid = lt.action_aid AND n.nid = l.nid AND lt.item_id = l.id AND l.id = %d
                       ORDER BY lt.created DESC', $item->id);
   while ($transaction = db_fetch_object($result)) {
     $transaction->library_status = isset($item->library_status) ? $item->library_status : LIBRARY_ITEM_AVAILABLE;
@@ -1017,28 +1022,19 @@ function library_get_transactions_by_item($item) {
 }
 
 function library_get_transactions_by_node($node) {
-  if ($node->type == 'patron') {
-    $temp_transactions = library_get_transactions_by_patron($node);
+  foreach ($node->items as $instance) {
+    $item = (object) $instance;
+    $temp_transactions = library_get_transactions_by_item($item);
     if (!empty($temp_transactions)) {
-      $transactions[] = $temp_transactions;
-    }
-  }
-  else {
-    foreach ($node->items as $instance) {
-      $item = (object) $instance;
-      $temp_transactions = library_get_transactions_by_item($item);
-      if (!empty($temp_transactions)) { 
-        $transactions[] = library_get_transactions_by_item($item);
-      }
+      $transactions[] = library_get_transactions_by_item($item);
     }
   }
   return $transactions;
 }
 
-function library_get_transactions_by_patron($node) {
-  $result = db_query('SELECT lt.created, lt.tid, la.aid, la.name as "action_name", la.status_change, lt.patron_id, lt.item_id, lt.duedate, lt.notes, n.title as "item_name", n.nid FROM {library_transactions} lt, {library_actions} la, {node} n WHERE la.aid = lt.action_aid AND n.nid = lt.nid AND lt.patron_id = %d ORDER BY lt.created DESC', $node->nid);
-  
-  $items_result = db_query('SELECT DISTINCT item_id FROM {library_transactions} WHERE patron_id = %d', $node->nid);
+function library_get_transactions_by_patron($user_page) {
+  $result = db_query('SELECT lt.created, lt.tid, la.aid, la.name as "action_name", la.status_change, lt.uid, lt.item_id, lt.duedate, lt.notes, n.title as "item_name", n.nid FROM {library_transactions} lt, {library_actions} la, {node} n WHERE la.aid = lt.action_aid AND n.nid = lt.nid AND lt.uid = %d ORDER BY lt.created DESC', $user_page->uid);
+  $items_result = db_query('SELECT DISTINCT item_id FROM {library_transactions} WHERE uid = %d', $user_page->uid);
   $statuses = array();
   $barcodes = array();
   $circulation = array();
@@ -1065,7 +1061,7 @@ function library_get_transactions_by_patron($node) {
 
 function library_get_transaction_by_tid($tid) {
   if (isset($tid) && is_numeric($tid)) {
-    $result = db_fetch_object(db_query('SELECT lt.created, la.name as "action_name", la.status_change, lp.nid as "patron_id", lp.name_last, lp.name_first, n.title as "item_name", n.type as "item_type", lt.item_id as "item_id", lt.nid as "nid", lt.duedate, lt.notes FROM {library_transactions} lt, {library_actions} la, {library_patrons} lp, {node} n WHERE la.aid = lt.action_aid AND lp.nid = lt.patron_id AND n.nid = lt.nid AND lt.tid = %d', $tid));
+    $result = db_fetch_object(db_query('SELECT lt.created, la.name as "action_name", la.status_change, lt.uid,  n.title as "item_name", n.type as "item_type", lt.item_id as "item_id", lt.nid as "nid", lt.duedate, lt.notes FROM {library_transactions} lt, {library_actions} la, {node} n WHERE la.aid = lt.action_aid AND n.nid = lt.nid AND lt.tid = %d', $tid));
     return $result;
   }
   else {
@@ -1175,13 +1171,10 @@ function library_get_action_links($item) {
   }
   $actions = library_actions($aids, $user);
   $action_links = array();
-  
+  #TODO: replaced view patron permissions with new one, proper solution?
   $patron_id = '';
-  if (!user_access('view patron content')) {
-    $user_patron = patron_load_by_uid($user->uid);
-    if (is_object($user_patron)) {
-      $patron_id = $user_patron->nid;
-    }
+  if (!user_access('search library patrons')) {
+      $patron_id = $user->uid;
   }
 
   foreach ($actions as $aid => $action) {
@@ -1524,4 +1517,71 @@ function library_get_status_text($item) {
     $text = variable_get('library_unavailable_noduedates_text', 'UNAVAILABLE');
   }
   return $text;
-}
\ No newline at end of file
+}
+
+/**
+ * Retrieve a pipe delimited string of autocomplete suggestions for existing patron.
+ */
+function library_patron_autocomplete($string) {
+  $matches = array();
+  if (module_exists('content_profile')) {
+    $passedstring=array();
+    $passedstring[]=check_plain($string);
+    $f=db_query("SELECT field_name FROM {content_node_field_instance} WHERE type_name='profile' AND widget_module='text'");
+    while ($a=db_fetch_object($f)) {
+      if (variable_get('library_content_profile_' . $a->field_name, FALSE)) {
+          if ($concat)
+            $concat .= ",', '," . $a->field_name . "_value";
+          else
+            $concat=$a->field_name . "_value";
+          $or .= " OR LOWER(" . $a->field_name . "_value) LIKE LOWER('%%%s%%')";
+          $passedstring[]=check_plain($string);
+      }
+    }
+    if ($concat) {
+      if (variable_get('library_content_profile_nodetitle', FALSE)) {
+        $passedstring[]=check_plain($string);
+        $result = db_query_range("SELECT n.uid,CONCAT(u.name,' (',n.title,', '," . $concat . ",')') as name FROM {node} n JOIN {content_type_profile} c ON c.vid=n.vid JOIN {users} u ON n.uid=u.uid WHERE (LOWER(n.title) LIKE LOWER('%%%s%%') OR LOWER(u.name) LIKE LOWER('%%%s%%')  " . $or .") AND n.type='profile'", $passedstring, 0, 10);
+      }
+      else {
+        $result = db_query_range("SELECT n.uid,CONCAT(u.name,' ('," . $concat . ",')') as name FROM {node} n JOIN {content_type_profile} c ON c.vid=n.vid JOIN {users} u ON n.uid=u.uid WHERE (LOWER(u.name) LIKE LOWER('%%%s%%') " . $or .") AND n.type='profile'", $passedstring, 0, 10);
+      }
+    }
+    else {
+      $result = db_query_range("SELECT uid,name FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", check_plain($string), 0, 10);
+    }
+
+  }
+  elseif (module_exists('profile')) {
+    /*
+     * Support for profile module
+     */
+    $f=db_query("SELECT fid,name FROM {profile_fields} WHERE type='textfield'"); #meh
+    while ($a=db_fetch_object($f)) {
+      if (variable_get('library_profile_' . $a->name, FALSE)) {
+          if ($fids)
+                  $fids .= "OR fid='" . $a->fid . "'";
+          else
+                  $fids .= "fid='" . $a->fid . "'";
+      }
+    }
+    if ($fids) {
+      $result = db_query_range("SELECT u.uid,CONCAT(u.name,' (',value,')') as name FROM {users} u LEFT JOIN {profile_values} v ON u.uid=v.uid WHERE (LOWER(name) LIKE LOWER('%%%s%%') or LOWER(value) LIKE LOWER('%%%s%%')) AND ( " . $fids . " OR fid IS NULL)", check_plain($string), check_plain($string), 0, 10);
+    }
+    else {
+      $result = db_query_range("SELECT uid,name FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", check_plain($string), 0, 10);
+    }
+
+  }
+  else {
+    $result = db_query_range("SELECT uid,name FROM {users} WHERE LOWER(name) LIKE LOWER('%%%s%%')", check_plain($string), 0, 10);
+  }
+
+
+  while ($patron = db_fetch_object($result)) {
+        $matches[$patron->name .' [uid:'. $patron->uid .']'] = check_plain($patron->name);
+  }
+
+  print drupal_to_js($matches);
+  exit();
+}
+
diff --git a/library.pages.inc b/library.pages.inc
index 8b9ee5c..39461a3 100644
--- a/library.pages.inc
+++ b/library.pages.inc
@@ -7,19 +7,20 @@
  */
 
 function library_transaction_form(&$form_state, $aid, $item = NULL) {
+   
   $patron_id = arg(4);
 
   if ($patron_id) {
-    $patron = node_load($patron_id);
+    $patron = user_load($patron_id);
   }
-  elseif (!user_access('view patron content')) {
-    global $user;
-    $user_patron = patron_load_by_uid($user->uid);
+  elseif (!user_access('search library patrons')) {
+    global $user;      
+    $user_patron = user_load($user->uid);
     if (is_object($user_patron)) {
       $patron = $user_patron;
     }
     else {
-      drupal_set_message('You do not have sufficient permissions.', 'error');
+      drupal_set_message(t('You do not have sufficient permissions.'), 'error');
       drupal_goto('/');
     }
   }
@@ -72,19 +74,19 @@ function library_transaction_form(&$form_state, $aid, $item = NULL) {
   else {
     $form['item_id'] = library_autocomplete_input($item);
   }
-  
+
   if ($patron) {
     $form['patron_id'] = array(
       '#type' => 'value',
-      '#value' => $patron->nid,
+      '#value' => $patron->uid,
     );
     $form['patron_id_set'] = array(
       '#type' => 'value',
-      '#value' => $patron->nid,
+      '#value' => $patron->uid,
     );
     $form['patron_display'] = array(
       '#type' => 'item',
-      '#value' => $patron->name_first .' '. $patron->name_last,
+      '#value' => $patron->name,
       '#title' => t('Patron'),
     );
     if (user_access('view patron content') && $action->status_change == LIBRARY_ACTION_NO_CHANGE) {
@@ -104,7 +106,7 @@ function library_transaction_form(&$form_state, $aid, $item = NULL) {
     $form['patron_id'] = array(
       '#type' => 'textfield',
       '#title' => t('Patron'),
-      '#default_value' => ($patron ? $patron->title .' [nid:'. $patron->nid .']' : ''),
+      '#default_value' => ($patron ? $patron->name .' [uid:'. $patron->uid .']' : ''),
       '#autocomplete_path' => 'patrons/autocomplete',
       '#required' => TRUE
     );
@@ -139,31 +141,27 @@ function library_transaction_form_validate($form, &$form_state) {
   //Validate patron information
   if ($form_state['values']['patron_id']) {
     if ($form_state['values']['patron_id_set'] && is_numeric($form_state['values']['patron_id'])) {
-      $nid = $form_state['values']['patron_id'];
-      $n_patron = node_load($nid);
-      if (empty($n_patron)) {
-        form_set_error('patron_id', t('Invalid Patron ID.'));
+      $user = $form_state['values']['patron_id'];
+      $u_patron = user_load($user);
+      if (empty($u_patron)) {
+        form_set_error('patron_id', t('Invalid Patron user ID.'));
       }
     }
     else {
-      preg_match('/^(?:\s*|(.*) )?\[\s*nid\s*:\s*(\d+)\s*\]$/', $form_state['values']['patron_id'], $matches);
+      preg_match('/^(?:\s*|(.*) )?\[\s*uid\s*:\s*(\d+)\s*\]$/', $form_state['values']['patron_id'], $matches);
       if (!empty($matches)) {
-        // explicit nid
-        list($temp, $title, $nid) = $matches;
-        if (!empty($title) && ($n_patron = node_load($nid))) {
-          if ($title != $n_patron->title) {
-            form_set_error('patron_id', t('Library Patron: Name mismatch. Please check your selection.'));
-          }
+        // explicit uid
+        list($temp, $name, $uidp) = $matches;
+        if (!($u_patron = user_load($uidp))) {
+          form_set_error('patron_id', t('Library Patron: Something went wrong when loading the user.'));
         }
       }
     }
-    if (!empty($n_patron)) {
-      $form_state['values']['patron_email'] = $n_patron->email;
-      $form_state['values']['patron_uid'] = $n_patron->patron_uid;
-      $form_state['values']['patron_id'] = $n_patron->nid;
-      $form_state['values']['patron_name'] = $n_patron->title;
-      $form_state['values']['patron_name_last'] = $n_patron->name_last;
-      $form_state['values']['patron_name_first'] = $n_patron->name_first;
+    if (!empty($u_patron)) {
+      $form_state['values']['patron_email'] = $u_patron->mail;
+      $form_state['values']['patron_id'] = $u_patron->uid;
+      $form_state['values']['patron_name'] = $u_patron->name;
+
     }
     else {
       form_set_error('patron_id', t('You must specify a library patron.'));
@@ -203,17 +201,17 @@ function library_transaction_form_validate($form, &$form_state) {
     if ($form_state['values']['action_aid']) {
       if ($item->in_circulation == LIBRARY_REFERENCE_ONLY && $action->status_change <> LIBRARY_ACTION_NO_CHANGE) {
         form_set_error('action_aid', t('This item is not in circulation.'));
-      } 
+      }
       elseif ($item->library_status == LIBRARY_ITEM_AVAILABLE && $action->status_change == LIBRARY_ITEM_TYPE_AVAILABLE) {
         form_set_error('action_aid', t('This item is already available.'));
       }
       elseif ($item->library_status == LIBRARY_ITEM_UNAVAILABLE &&  $action->status_change == LIBRARY_ITEM_TYPE_UNAVAILABLE) {
         form_set_error('action_aid', t('This item is not currently available.'));
       }
-      elseif ($item->library_status == LIBRARY_ITEM_UNAVAILABLE && $n_patron->nid <> $item->last_patron_id) {
+      elseif ($item->library_status == LIBRARY_ITEM_UNAVAILABLE && $u_patron->uid <> $item->last_patron_id) {
         form_set_error('patron_id', t('This item was made unavailable by a different patron.  Only that patron can perform actions on it.'));
       }
-    }  
+    }
   }
 }
 
@@ -237,7 +237,7 @@ function library_transaction_form_submit($form, &$form_state) {
   elseif ($form_state['values']['action_status_change'] == LIBRARY_ACTION_TYPE_AVAILABLE) {
     $new_status = LIBRARY_ITEM_AVAILABLE;   
   }
-  db_query("INSERT {library_transactions} (nid, item_id, patron_id, action_aid, duedate, notes, created) VALUES (%d, %d, %d, %d, %d, '%s', %d)", $form_state['values']['nid'], $form_state['values']['item_id'], $form_state['values']['patron_id'], $form_state['values']['action_aid'], $duedate, check_plain($form_state['values']['notes']), $now);
+  db_query("INSERT {library_transactions} (nid, item_id, uid, action_aid, duedate, notes, created) VALUES (%d, %d, %d, %d, %d, '%s', %d)", $form_state['values']['nid'], $form_state['values']['item_id'], $form_state['values']['patron_id'], $form_state['values']['action_aid'], $duedate, check_plain($form_state['values']['notes']), $now);
   if ($form_state['values']['action_status_change'] > LIBRARY_ACTION_NO_CHANGE) {
     db_query("UPDATE {library} set library_status = %d WHERE id = %d", $new_status, $form_state['values']['item_id']);
   }
@@ -267,7 +268,8 @@ function library_transaction_view($tid) {
     $list[] = t("Date: @action_date", array('@action_date' => format_date($transaction->created, 'custom', 'M j, Y')));
     $list[] = t("Item: ". l($transaction->item_name, 'node/'. $transaction->nid));
     $list[] = t("Action: @action", array('@action' => $transaction->action_name));
-    $list[] = t("Patron: ". l($transaction->name_first .' '. $transaction->name_last, 'node/'. $transaction->patron_id));
+    $patron=user_load($transaction->uid);
+    $list[] = t("Patron: ". l($patron->name, 'user/'. $transaction->uid));
     if (!empty($transaction->duedate)) {
       $list[] = t('Due Date: @due_date', array('@due_date' => format_date($transaction->duedate, 'custom', 'M j, Y')));
     }
@@ -284,11 +286,13 @@ function library_transaction_view($tid) {
 /**
  * Menu callback; show the transaction history of a single node.
  */
-function library_history($node) { 
-  $duedate_enabled = library_duedates_enabled($node->type);  
+function library_history($node) {
+  $duedate_enabled = library_duedates_enabled($node->type);
   global $user;
 
-  if ($node->type == 'patron') {
+  $user_page=user_load(arg(1));
+
+  if (is_object($user_page)) {
     $is_patron = TRUE;
   }
   else {
@@ -302,9 +306,13 @@ function library_history($node) {
     }
     $header[] = t('Actions');
     $rows = array();
-
-    $transactions = library_get_transactions_by_node($node);
-
+    if ($is_patron) {
+      $transactions = array();
+      $transactions[] = library_get_transactions_by_patron($user_page);
+    }
+    else {
+      $transactions = library_get_transactions_by_node($node);
+    }
     if (!empty($transactions[0])) {
       foreach ($transactions as $value) {
         $last_item = '';
@@ -320,10 +328,10 @@ function library_history($node) {
             $duedate = '';
           }
           if (user_access('administer transactions')) {
-            $detail_link = l('View Details', 'library-items/transaction/view/'. $transaction->tid);
+            $detail_link = l(t('View Details'), 'library-items/transaction/view/'. $transaction->tid);
           }
           if ($cur_item <> $last_item) {
-            $item = array('id' => $transaction->item_id, 'library_status' => $transaction->library_status, 'last_patron_id' => $transaction->patron_id, 'in_circulation' => $transaction->in_circulation);
+            $item = array('id' => $transaction->item_id, 'library_status' => $transaction->library_status, 'last_patron_id' => $transaction->uid, 'in_circulation' => $transaction->in_circulation);
             $links = library_get_action_links($item);
             if (!empty($links)) {
               $action_link = implode(" | ", $links);
             }
diff --git a/patron/patron.info b/patron/patron.info
deleted file mode 100644
index d764b1b..0000000
--- a/patron/patron.info
+++ /dev/null
@@ -1,7 +0,0 @@
-; $Id: patron.info,v 1.3 2008/08/13 23:20:16 jastraat Exp $
-name 		= "Patron"
-description 	= "Create a patron content type for use with the library module.  This module must be enabled if you wish to use library."
-package 	= Library
-core 		= "6.x"
-
-
diff --git a/patron/patron.install b/patron/patron.install
deleted file mode 100644
index 928233a..0000000
--- a/patron/patron.install
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-// $Id: patron.install,v 1.3 2010/05/24 17:07:33 jastraat Exp $
-
-/**
- * @author Jess Straatmann
- * @file patron.install
- * Install and uninstall all required databases.
- * Also do incremental database updates.
- */
- 
-function patron_schema() {
- $schema['library_patrons'] = array(
-    'description' => t('The table where patron information is stored.'),
-    'fields' => array(
-      'nid' => array(
-        'description' => t('The primary identifier for a node.'),
-        'type' => 'serial',
-        'unsigned' => TRUE,
-        'not null' => TRUE),
-      'name_last' => array(
-        'description' => t('The patron last name.'),
-        'type' => 'varchar',
-        'length' => 60,
-        'not null' => TRUE,
-        'default' => ''),
-      'name_first' => array(
-        'description' => t('The patron first name.'),
-        'type' => 'varchar',
-        'length' => 60,
-        'not null' => TRUE,
-        'default' => ''),
-      'email' => array(
-        'description' => t('The patron email.'),
-        'type' => 'varchar',
-        'length' => 60,
-        'not null' => TRUE,
-        'default' => ''),
-      'patron_uid' => array(
-        'description' => t('Drupal user id of the user corresponding to this patron.'),
-        'type' => 'int',
-        'not null' => FALSE,
-        'unsigned' => TRUE,
-        'default' => NULL),
-      'barcode' => array(
-        'description' => t('Card number for this patron.'),
-        'type' => 'varchar',
-        'length' => 60,
-        'not null' => FALSE,
-        'default' => ''),
-      'disabled' => array(
-        'description' => t('Boolean indicating whether the patron account is disabled.'),
-        'type' => 'int',
-        'not null' => TRUE,
-        'default' => 0),
-      ),
-    'indexes' => array(
-      ),
-    'unique keys' => array(
-      'email'     => array('email'),
-      'patron_uid'     => array('patron_uid'),
-      ),
-    'primary key' => array('nid'),
-    );
-  return $schema;
-}
-
-/**
- * Implementation of hook_install()
- */
-function patron_install() {
-  drupal_install_schema('patron');
-
-  // Notify of changes
-  drupal_set_message(t("Library patron module successfully installed."));
-
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function patron_uninstall() {
-  variable_del('patron_is_user');
-  variable_del('patron_use_barcodes');
-  variable_del('patron_autocreate');
-  
-  $result = db_query("SELECT nid FROM {node} WHERE type = 'patron'");
-  
-  if ($result) {
-    while ($row = db_fetch_object($result)) {
-      set_time_limit(5);
-      node_delete($row->nid);
-    }
-  }
-  
-  drupal_uninstall_schema('patron');
-  
-  // Clear the cache tables.
-  cache_clear_all(null, 'cache');
-  cache_clear_all(null, 'cache_filter');
-  cache_clear_all(null, 'cache_menu');
-  cache_clear_all(null, 'cache_page');
-
-  drupal_set_message(t('Library patron module successfully uninstalled'));
-}
-
-function patron_update_1() {
-  $ret = array();
-  $ret[] = update_sql("UPDATE {library_patrons} SET patron_uid = NULL WHERE patron_uid = 0");
-  return $ret;
-}
diff --git a/patron/patron.module b/patron/patron.module
deleted file mode 100644
index d7600b4..0000000
--- a/patron/patron.module
+++ /dev/null
@@ -1,619 +0,0 @@
-<?php
-// $Id: patron.module,v 1.8 2010/05/24 17:07:33 jastraat Exp $ 
-
-/**
- * Library patrons do not have barcodes.
- */
-define('PATRON_NO_BARCODES', 0);
-
-/**
- * Library Patrons have barcodes.
- */
-define('PATRON_BARCODES', 1);
-
-/**
- * Library Patrons are not users.
- */
-define('PATRON_NOT_USER', 0);
-
-/**
- * Library Patrons may be users.
- */
-define('PATRON_USER', 1);
-
-/**
- * Patron may use the library
- */
-define('PATRON_ENABLED', 0);
-
-/**
- * Patron may not currently use the library
- */
-define('PATRON_DISABLED', 1);
-
-/**
-* Valid permissions for this module
-* @return array An array of valid permissions for this module
-*/
-function patron_perm() {
-  return array(
-    'create patron content', 
-    'edit own patron content', 
-    'edit any patron content',
-    'delete patron content',
-    'view patron content',
-    'administer patrons');
-}
-
-/**
- * Implementation of hook_help()
- */
-function patron_help($path, $arg) {
-  switch ($path) {
-    case 'patrons/email':
-      if ($arg[2]) {
-        return t('<p>The form below will send an email to the patron specified. If no patron is specified, the email will be sent to all active patrons.</p>', array());
-      }
-      else {
-        return t('<p>The form below will send an email to all active patrons.</p>', array());
-      }
-  }
-}
-
-/**
- * Implementation of hook_node_info().
- */
-function patron_node_info() {
-  return array(
-    'patron' => array(
-      'name' => t('Library Patron'),
-      'module' => 'patron',
-      'description' => t('Library patrons are individuals with whom library items may be associated.'),
-      'has_title' => TRUE,
-      'title_label' => t('Complete Name'),
-      'has_body' => FALSE,
-    )
-  );
-}
-
-/**
- * Implemenation of hook_access().
- */
-function patron_access($op, $node, $account) {
-  if ($op == 'view') {
-    //Come back and change this to change patron_uid
-    if (user_access('view patron content', $account) || ((variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER) && ($account->uid == $node->patron_uid))) {
-      return TRUE;
-    }
-    else {
-      return FALSE;
-    }
-  }
-  if ($op == 'create') {
-    return user_access('create patron content', $account);
-  }
-
-  if ($op == 'update') {
-    if (user_access('edit any patron content', $account) || (variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER && user_access('edit own patron content', $account) && ($account->uid == $node->patron_uid))) {
-      return TRUE;
-    }
-  }
-  if ($op == 'delete') {
-    return user_access('delete patron content', $account);
-  }
-}
-
-/** 
- * Implementation of hook_db_rewrite_sql().
- */
-function patron_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
-  if ($query == '' && $primary_table == 'n' && $primary_field = 'nid' && empty($args)) {
-    $excluded_types = array('patron');
-    if (!empty($excluded_types)) {
-      $where = " n.type NOT IN ('". join("','", $excluded_types) ."') ";
-      return array('where' => $where);
-    }
-  }
-}
-
-/**
- * Implemenation of hook_insert().
- */
-function patron_insert($node) {
-  if (empty($node->patron_uid)) {
-    db_query("INSERT INTO {library_patrons} (nid, name_last, name_first, email, patron_uid, barcode, disabled) VALUES (%d, '%s', '%s', '%s', NULL, '%s', %d)", $node->nid, $node->name_last, $node->name_first, $node->email, $node->barcode, $node->disabled);
-  }
-  else {
-    db_query("INSERT INTO {library_patrons} (nid, name_last, name_first, email, patron_uid, barcode, disabled) VALUES (%d, '%s', '%s', '%s', %d, '%s', %d)", $node->nid, $node->name_last, $node->name_first, $node->email, $node->patron_uid, $node->barcode, $node->disabled);
-  }
-}
-
-/**
- * Implemenation of hook_update().
- */
-function patron_update($node) {
-  if (empty($node->patron_uid)) {
-    db_query("UPDATE {library_patrons} SET name_last = '%s', name_first = '%s', email = '%s', patron_uid = NULL, barcode = '%s', disabled = %d WHERE nid = %d", $node->name_last, $node->name_first, $node->email, $node->barcode, $node->disabled, $node->nid); 
-  }
-  else {
-    db_query("UPDATE {library_patrons} SET name_last = '%s', name_first = '%s', email = '%s', patron_uid = %d, barcode = '%s', disabled = %d WHERE nid = %d", $node->name_last, $node->name_first, $node->email, $node->patron_uid, $node->barcode, $node->disabled, $node->nid); 
-  }
-}
-
-/**
- * Implemenation of hook_delete().
- */
-function patron_delete($node) {
-  if (module_exists('library')) {
-    db_query("DELETE FROM {library_transactions} WHERE patron_id = %d", $node->nid); 
-  }
-  db_query("DELETE FROM {library_patrons} WHERE nid = %d", $node->nid); 
-}
-
-/**
- * Implemenation of hook_nodeapi().
- */
-function patron_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
-  if ($node->type == 'patron') {
-    switch ($op) {
-      case 'view':
-        $node->title = $node->name_first .' '. $node->name_last;
-        if (user_access('view patron content')) {
-          $node->content['email'] = array(
-            '#value' => '<div class="field-patron-email">'. patron_email_link($node) .'</div>',
-            '#weight' => 0,
-          );
-        }
-        if ($node->disabled == PATRON_DISABLED) {
-          $node->content['disabled'] = array(
-            '#value' => '<div class="field-patron-disabled">Disabled</div>',
-            '#weight' => 2,
-          );
-        }
-        if (variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER && !empty($node->patron_uid) && user_access('access user profiles')) {
-          $patron_user = user_load($node->patron_uid);
-          if ($patron_user) {
-            $node->content['patron_uid'] = array(
-              '#value' => '<div class="field-patron-user"><label>Drupal User: </label>'. l($patron_user->name, 'user/'. $patron_user->uid) .'</div>',
-              '#weight' => -3,
-            );
-          }
-        }
-        if (variable_get('patron_use_barcodes', PATRON_NO_BARCODES) == PATRON_BARCODES) {
-          $node->content['barcode'] = array(
-            '#value' => '<div class="field-patron-barcode"><label>Card Number: </label>'. $node->barcode .'</div>',
-            '#weight' => -1,
-          );
-        }
-        global $user;
-        watchdog('library', '%user viewed patron %name', array('%user' => $user->name, '%name' => $node->title));
-        break;
-
-      case 'presave':
-        if (!empty($node->email) && variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER) {
-          $patron_uid = db_result(db_query_range("SELECT uid from {users} where mail= '%s'", $node->email, 0, 1));
-          if ($patron_uid) {
-            $node->patron_uid = $patron_uid;
-            $node->uid = $patron_uid;   
-          }
-          else {
-            $node->patron_uid = NULL;
-          }
-        } 
-        break;
-    }
-  }
-}
-
-/**
- * Implemenation of hook_load().
- */
-
-function patron_load($node) {
-  $additions = db_fetch_object(db_query("SELECT * FROM {library_patrons} WHERE nid = %d", $node->nid));
-  return $additions;
-}
-
-/**
- * Implementation of hook_form().
- */
-function patron_form(&$node) {
-  $type = node_get_types('type', $node);
-  $patrons_are_users = variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER;
-  $patron_uid = NULL;
-  if ($patrons_are_users && !empty($node->email)) {
-    $exists = db_result(db_query_range("SELECT uid from {users} where mail= '%s'", $node->email, 0, 1));
-    if ($exists) {
-      $patron_uid = $exists;
-    }
-  }
-
-  // We need to define form elements for the node's title and body.
-  if ($type->has_title) {
-    $form['title'] = array(
-      '#type' => 'textfield',
-      '#title' => 'Patron Identifier (ID or Complete Name)',
-      '#required' => TRUE,
-      '#default_value' => $node->title,
-      '#description' => t('This must be unique.'),
-      '#weight' => -5
-    );
-  }
-  if ($type->has_body) {
-    $form['body_field'] = node_body_field($node, $type->body_label, $type->min_word_count);
-  }
-
-  $form['required_for_library'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Required Library Fields'),
-    '#collapsed' => FALSE,
-    '#weight' => -3
-  );
-  // Now we define the form elements specific to our node type.
-  $form['required_for_library']['name_first'] = array(
-    '#type' => 'textfield',
-    '#title' => t('First Name'),
-    '#default_value' => $node->name_first,
-    '#size' => 10,
-    '#maxlength' => 30,
-    '#weight' => -4,
-    '#required' => TRUE
-  );
-  $form['required_for_library']['name_last'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Last Name'),
-    '#default_value' => $node->name_last,
-    '#size' => 10,
-    '#maxlength' => 30,
-    '#weight' => -3,
-    '#required' => TRUE
-  );
-  $form['required_for_library']['email'] = array(
-    '#type' => 'textfield',
-    '#title' => t('E-mail'),
-    '#default_value' => $node->email,
-    '#size' => 20,
-    '#maxlength' => 30,
-    '#weight' => -1,
-    '#required' => TRUE,
-  );
-  if ($patrons_are_users) {
-    $form['required_for_library']['email']['#autocomplete_path'] = 'patrons/js/email';
-    if (!user_access('administer patrons') || !user_access('access user profiles')) {
-      $form['required_for_library']['email']['#access'] = FALSE;
-    }
-    $form['required_for_library']['email']['#description'] = t('If this email address matches an existing Drupal user, that user will be associated with this patron. Similar user emails will be suggested when you begin entering a value.');
-    $form['required_for_library']['patron_uid'] = array(
-      '#type' => 'value',
-      '#value' => $patron_uid,
-    );
-  }
-  if (variable_get('patron_use_barcodes', PATRON_NO_BARCODES) == PATRON_BARCODES) {
-    $form['required_for_library']['barcode'] = array(
-      '#type' => 'textfield',
-      '#size' => 30,
-      '#maxlength' => 60,
-      '#title' => t('Patron Card Number/Barcode'),
-      '#default_value' => $node->barcode,
-      '#weight' => 0,
-      '#required' => TRUE
-    );
-  }
-  $form['required_for_library']['disabled'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Disabled'),
-    '#default_value' => $node->disabled,
-    '#return_value' => PATRON_DISABLED,
-    '#description' => t('Disabled patrons will not appear in patron lists and may not use the library'),
-    '#weight' => 6,
-  );
-  return $form;
-}
-
-/**
- * Implementation of hook_validate().
- */
-function patron_validate(&$node) {
-  //Validate email
-  if (!empty($node->email)) {
-    if (!valid_email_address($node->email)) {
-      form_set_error('email', t('Invalid email address.'));
-    }
-    else {
-      $result = db_result(db_query_range("SELECT nid from {library_patrons} where email= '%s' and nid <> '%d'", $node->email, $node->nid, 0, 1));
-      if ($result) {
-        form_set_error('email', t("Duplicate email address. ". l('View existing entry with this email address.', 'node/'. $result)));
-      }
-    }
-  }
-  //Validate identifier
-  $dup_result = db_result(db_query_range("SELECT nid FROM {node} WHERE title= '%s' AND nid <> %d AND type='patron'", $node->title, $node->nid, 0, 1));
-  if ($dup_result) {
-    form_set_error('title', t("A Patron with that identifier already exists. ". l('View existing entry.', 'node/'. $dup_result)));
-  }
-  //Validate that barcode is unique
-  if (variable_get('patron_use_barcodes', PATRON_NO_BARCODES) == PATRON_BARCODES) {
-    if (!empty($node->barcode)) {
-      $node->barcode = check_plain($node->barcode);
-      $not_unique = db_result(db_query("SELECT COUNT(*) FROM {library_patrons} WHERE barcode = '%s' AND barcode <> '' AND nid <> %d", $node->barcode, $node->nid));
-      if ($result) {
-        form_set_error('barcode', t('The barcode %barcode already exists. Please enter a different barcode.', array('%barcode' => $node->barcode)));
-      }
-    }
-  }
-}
-
-/**
-* Retrieve a pipe delimited string of autocomplete suggestions for existing patron
-*/
-function patron_autocomplete($string) {
-  $matches = array();
-  $result = db_query_range("SELECT n.nid, lp.barcode, n.title FROM {node} n, {library_patrons} lp WHERE lp.nid = n.nid AND n.type = 'patron' AND lp.disabled = %d AND (LOWER(n.title) LIKE LOWER('%%%s%%') OR lp.barcode = '%s')", PATRON_ENABLED, check_plain($string), check_plain($string), 0, 10);
-  $barcodes = variable_get('patron_use_barcodes', PATRON_NO_BARCODES);
-  while ($patron = db_fetch_object($result)) {
-    if ($barcodes == PATRON_BARCODES && !empty($patron->barcode)) {
-      $matches[$patron->title .' [nid:'. $patron->nid .']'] = check_plain($patron->barcode) .' ('. check_plain($patron->title) .')';
-    }
-    else {
-      $matches[$patron->title .' [nid:'. $patron->nid .']'] = check_plain($patron->title);
-    }
-  }
-  print drupal_to_js($matches);
-  exit();
-}
-
-/**
-* Retrieve a pipe delimited string of autocomplete suggestions for existing patron
-*/
-function patron_email_autocomplete($string) {
-  $matches = array();
-  $result = db_query_range("SELECT mail from {users} where status = 1 AND LOWER(mail) LIKE LOWER('%s%%')", check_plain($string), 0, 10);
-  while ($patron = db_fetch_object($result)) {
-    $matches[$patron->mail] = check_plain($patron->mail);
-  }
-  print drupal_to_js($matches);
-  exit();
-}
-
-/**
- * Retrieve a list of patrons
- * @param $nid 
- *  If this is blank, only active patrons are returned.  If 'all', all are returned.  If a number, a specific patron is returned. 
- */
-function patron_get_patrons($nid = NULL) {
-  if (!$nid) {
-    $result = db_query("SELECT * FROM {node} n, {library_patrons} lp WHERE lp.nid = n.nid AND n.type = 'patron' AND lp.disabled = %d ORDER BY lp.name_last, lp.name_first", PATRON_ENABLED);
-  }
-  elseif (is_numeric($nid)) {
-    $result = db_query_range("SELECT * FROM {node} n, {library_patrons} lp WHERE lp.nid = n.nid AND n.type = 'patron' AND n.nid = %d ORDER BY lp.name_last, lp.name_first", $nid, 0, 1);
-  }
-  else {
-     $result = db_query("SELECT * FROM {node} n, {library_patrons} lp WHERE lp.nid = n.nid AND n.type = 'patron' ORDER BY lp.name_last, lp.name_first");
-  }
-  $patrons = array();
-  while ($patron = db_fetch_object($result)) {
-    $patrons[] = $patron;
-  }
-  return empty($patrons) ? FALSE : $patrons;
-}
-
-/**
- * Implementation of hook_menu()
- */
-function patron_menu() {
-  $items = array();
-  $items['patrons/autocomplete'] = array(
-    'title' => t('Patron Autocomplete'),
-    'page callback' => 'patron_autocomplete', 
-    'access arguments' => array('access content'), 
-    'type' => MENU_CALLBACK
-  );
-  $items['patrons'] = array(
-    'title' => 'Patrons',
-    'page callback' => 'patron_list_patrons',
-    'access arguments' => array('view patron content'),
-    'file' => 'patron.pages.inc',
-  );
-  $items['patrons/email'] = array(
-    'title' => 'Send Email',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('patron_email_form'),
-    'access arguments' => array('edit any patron content'),
-    'file' => 'patron.pages.inc',
-  );
-  $items['admin/settings/library/patrons'] = array(
-    'title' => 'Patron Settings',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('patron_admin_settings'),
-    'access arguments' => array('administer patrons'),
-  );
-  $items['patrons/js/email'] = array(
-    'page callback' => 'patron_email_autocomplete',
-    'type' => MENU_CALLBACK,
-    'access arguments' => array('access content'), 
-  );
-  return $items;
-}
-
-function patron_email_js() {
-  $email = $_POST['email'];
-  if ($email != '' && !is_null($email)) {
-    $exists = db_query_range("SELECT uid, name from {users} where mail= '%s'", $node->email, 0, 1);
-    if ($exists) {
-      while ($patron = db_fetch_object($exists)) {
-        // Build the new form.
-        $form_state = array('submitted' => FALSE);
-        $form_build_id = $_POST['form_build_id'];
-        
-        // We retreive the cached form, change the value, and resave.
-        $form = form_get_cache($form_build_id, $form_state);
-        form_set_value($form['required_for_library']['patron_uid'], $patron->uid, $form_state);
-        
-        $output = 'Matching Drupal user found. Username: '. $patron->name;
-        print drupal_json(array('data' => $output));
-      }
-    }
-  }
-}
-
-/**
- * Menu callback: Edit Patron Settings.
- */
-function patron_admin_settings() {
-  $form = array();
-  $form['patron_use_barcodes'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Use Library Cards (with Barcodes) for Library Patrons'),
-    '#default_value' => variable_get('patron_use_barcodes', 0),
-    '#return_value' => 1,
-    '#description' => t('This will allow you to use library cards.  However, you must have a unique barcode for every patron.'),
-  );
-  $form['user_settings'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('User Settings'),
-  );
-  $form['user_settings']['patron_is_user'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Associate Library Patrons with Drupal Users'),
-    '#default_value' => variable_get('patron_is_user', 0),
-    '#return_value' => 1,
-    '#description' => t('You must create the user account first, and the Drupal user and library patron must have the same email address.'),
-  );
-  /* Only allow if patrons do NOT have library cards!! */
-  if (variable_get('patron_use_barcodes', PATRON_NO_BARCODES) == PATRON_NO_BARCODES) {
-    $form['user_settings']['patron_autocreate'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Autocreate Library Patron on User Registration and Delete on User Deletion'),
-      '#default_value' => variable_get('patron_autocreate', 0),
-      '#return_value' => 1,
-      '#description' => t('You must associate library patrons with drupal users first.'),
-    );
-  }
-  return system_settings_form($form);
-}
-
-/**
- * Implementation of hook_mail()
- */
-function patron_mail($key, &$message, $params) {
-  $language = $message['language'];
-  switch ($key) {
-    case 'email_form':
-      $message['subject'] .= $params['subject'];
-      $message['body'][] = $params['message'];
-      break;
-  } 
-}
-
-function patron_email_link($patron) {
-  $output = '';
-  if ($patron->email) {
-    $output = l('E-mail', 'patrons/email/'. $patron->nid);
-  }
-  return $output;
-}
-
-/**
- * Implementation of hook_user().
- */
-function patron_user($op, &$edit, &$user, $category = NULL) {
-  if (variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER) {
-    switch ($op) {
-      case 'load':
-        $user->patron = patron_load_by_uid($user->uid);
-        break;
-      case 'after_update':
-        //If the user email has changed, update the patron email to match
-        $node = patron_load_by_uid($user->uid);
-        if (!empty($node) && $node->email != $user->mail) {
-          $node->email = $user->mail;
-          node_save($node);
-        }
-        break;
-      case 'view':
-        $patron = patron_load_by_uid($user->uid);
-        $cur_user = $GLOBALS['user'];
-
-        if (variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER && !empty($patron) && (node_access('view', 'patron') || $cur_user->uid == $user->uid)) {
-          $user->content['patron_name'] = array(
-            '#type' => 'user_profile_item',
-            '#title' => 'Patron Name',
-            '#value' => l($patron->name_first .' '. $patron->name_last, 'node/'. $patron->nid),
-            '#attributes' => array('class' => 'profile-patron'),
-          );
-        }
-        break;
-      case 'register':
-        if (variable_get('patron_autocreate', 0) == 1) {
-          return patron_register_form();
-        }
-        break;
-      case 'insert':
-        if (variable_get('patron_autocreate', 0) == 1 && isset($edit['name_last'])) {
-          return patron_create_patron($edit, $user);
-        }
-        break;
-      case 'delete':
-        //$patron = patron_load_by_uid($user->uid);
-        //if (variable_get('patron_autocreate', 0) == 1 && !empty($patron) && is_numeric($patron->nid)) {
-          //node_delete($patron->nid);
-        //}
-        break;
-    }
-  }
-}
-
-function patron_load_by_uid($uid) {
-  if (variable_get('patron_is_user', PATRON_NOT_USER) == PATRON_USER && is_numeric($uid)) {
-    $nid = db_result(db_query_range("SELECT nid FROM {library_patrons} WHERE patron_uid = %d", $uid, 0, 1));
-    if ($nid) {
-      $node = node_load($nid);
-      return $node;
-    }
-  }
-  return '';
-}
-
-function patron_register_form() {
-  $form = array();
-  $form['required_for_library'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Required Patron Fields'),
-    '#collapsed' => FALSE,
-    '#weight' => -3
-  );
-  $form['required_for_library']['name_first'] = array(
-    '#type' => 'textfield',
-    '#title' => t('First Name'),
-    '#default_value' => '',
-    '#size' => 10,
-    '#maxlength' => 30,
-    '#weight' => -4,
-    '#required' => TRUE
-  );
-  $form['required_for_library']['name_last'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Last Name'),
-    '#default_value' => '',
-    '#size' => 10,
-    '#maxlength' => 30,
-    '#weight' => -3,
-    '#required' => TRUE
-  );
-
-  return $form;
-}
-
-function patron_create_patron(&$edit, $user) {
-  $node = (object) array(
-    'type' => 'patron',
-    'title' => check_plain($edit['name_last']) .', '. check_plain($edit['name_first']),
-    'name' => $user->name,
-    'uid' => $user->uid,
-    'email' => $user->mail,
-    'name_last' => check_plain($edit['name_last']),
-    'name_first' => check_plain($edit['name_first']),
-    'patron_uid' => $user->uid,
-  );
-  node_save($node);
-}
\ No newline at end of file
diff --git a/patron/patron.pages.inc b/patron/patron.pages.inc
deleted file mode 100644
index 941715b..0000000
--- a/patron/patron.pages.inc
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-// $Id: patron.pages.inc,v 1.3 2009/11/23 19:06:53 jastraat Exp $
-
-/**
- * @file
- * Functions for generating page displays related to the patron module
- */
-
-
-function patron_list_patrons() {
-  $patrons = patron_get_patrons('all');
-  if ($patrons) {
-    $header = array(t('Name'), t('Status'));
-    $header[] = t('Actions');
-    $rows = array();
-    foreach ($patrons as $patron) {
-      if ($patron->disabled == PATRON_DISABLED) {
-        $patron->disabled = 'Disabled';
-      }
-      else {
-        $patron->disabled = 'Active';
-      }
-      $rows[] = array($patron->name_last .', '. $patron->name_first, $patron->disabled, l('View', 'node/'. $patron->nid) .' | '. patron_email_link($patron));
-    }
-    return theme('table', $header, $rows); 
-  }
-  else {
-    return "<p>No patrons found.</p>";
-  }
-}
-
-function patron_email_form(&$form_state) {
-  $form = array();
-
-  $patron_id = arg(2);
-  if ($patron_id) {
-    $patron = patron_get_patrons($patron_id);
-    $to = $patron[0]->email;
-    $name = $patron[0]->name_first .' '. $patron[0]->name_last;
-    if ($patron) {
-      $form['to'] = array(
-        '#type' => 'value',
-        '#value' => ($to ? $to : ''),
-        '#required' => FALSE,
-      );
-      $form['patron_name'] = array(
-        '#type' => 'item',
-        '#title' => t('To'),
-        '#value' => $name,
-        '#required' => FALSE,
-      );
-      $form['patron'] = array(
-        '#type' => 'value',
-        '#value' => $name,
-        '#required' => FALSE,
-      );
-    }
-  }
-
-  $form['subject'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Subject'),
-    '#maxlength' => 255,
-    '#required' => TRUE
-  );
-  $form['message'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Message'),
-    '#required' => TRUE,
-  );
-  $form['submit'] = array(
-    '#type' => 'submit',
-    '#value' => t('Send E-mail'),
-  );
-  
-  return $form;
-}
-
-function patron_email_form_validate($form, &$form_state) {
-  if ($form_state['values']['to'] && !valid_email_address($form_state['values']['to'])) {
-    form_set_error('to', t('Invalid patron email.'));
-  }
-}
-
-function patron_email_form_submit($form, &$form_state) {
-  $values = $form_state['values']; 
-  if ($values['to']) {
-    $to = $values['to'];
-    $recipients = $values['patron'];
-  }
-  else { 
-    $patrons = patron_get_patrons();
-
-    $to_array = array();
-    $recipient_array = array();
-    foreach ($patrons as $patron) {
-      $to_array[] = $patron->email;
-      $recipient_array[] = $patron->name_first .' '. $patron->name_last;
-    }
-    $to = implode(',', $to_array);
-    $recipients = implode(', ', $recipient_array);
-  }
-  if (drupal_mail('patron', 'email_form', $to, language_default(), $values)) {
-    watchdog('library', 'Sent email to %recipient', array('%recipient' => $recipients));
-    drupal_set_message(t('Your message has been sent to '. $recipients));
-  }
-  else {
-    watchdog('error', 'Unable to send email to %recipient', array('%recipient' => $recipients));
-  }
-  return;
-}
\ No newline at end of file
