diff --git a/tests/user_relationships_test.module b/tests/user_relationships_test.module
index 3e558ca..3ce6971 100644
--- a/tests/user_relationships_test.module
+++ b/tests/user_relationships_test.module
@@ -1,7 +1,5 @@
 <?php
 
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * @todo This is currently only used to define dependencies. 
  */
-?>
diff --git a/user_relationship_blocks/user_relationship_blocks.module b/user_relationship_blocks/user_relationship_blocks.module
index e9b6328..51a5aba 100644
--- a/user_relationship_blocks/user_relationship_blocks.module
+++ b/user_relationship_blocks/user_relationship_blocks.module
@@ -9,11 +9,11 @@
 /**
  * Constants
  */
-define('UR_BLOCK_ALL_TYPES',  'all');
+define('UR_BLOCK_ALL_TYPES', 'all');
 
-define('UR_BLOCK_SEPARATOR',  '-');
+define('UR_BLOCK_SEPARATOR', '-');
 
-define('UR_BLOCK_MY',   'my');
+define('UR_BLOCK_MY', 'my');
 define('UR_BLOCK_USER', 'user');
 
 /**
@@ -36,17 +36,17 @@ function user_relationship_blocks_theme() {
 
     'user_relationships_block' => array(
       'variables' => array('account' => NULL, 'settings' => NULL, 'extra' => NULL),
-      'path'      => drupal_get_path('module', 'user_relationship_blocks') .'/templates',
+      'path'      => drupal_get_path('module', 'user_relationship_blocks') . '/templates',
       'template'  => 'user_relationships-block',
     ),
     'user_relationships_pending_block' => array(
       'variables' => array('account' => NULL, 'settings' => NULL),
-      'path'      => drupal_get_path('module', 'user_relationship_blocks') .'/templates',
+      'path'      => drupal_get_path('module', 'user_relationship_blocks') . '/templates',
       'template'  => 'user_relationships-pending_block',
     ),
     'user_relationships_actions_block' => array(
-      'variables' => array('account' => NULL, 'settings' => NULL) ,
-      'path'      => drupal_get_path('module', 'user_relationship_blocks') .'/templates',
+      'variables' => array('account' => NULL, 'settings' => NULL),
+      'path'      => drupal_get_path('module', 'user_relationship_blocks') . '/templates',
       'template'  => 'user_relationships-actions_block',
     ),
   );
@@ -150,7 +150,7 @@ function user_relationship_blocks_block_configure($delta) {
 
     if ($extra) {
       $relation = $extra == 'you_to_them' ? t('requester') : t('requestee');
-      $msg .= "\n". t("Because this relationship is one-way this block will show relationships where the @user_identifier is the @relation", array('@user_identifier' => $user_identifier, '@relation' => $relation));
+      $msg .= "\n" . t("Because this relationship is one-way this block will show relationships where the @user_identifier is the @relation", array('@user_identifier' => $user_identifier, '@relation' => $relation));
     }
 
     //$sort_var = "{$var}_sort";
@@ -207,7 +207,7 @@ function user_relationship_blocks_block_view($delta) {
       $account = $user;
     }
   }
-  else if ($uid = _user_relationship_blocks_get_uid($delta)) {
+  elseif ($uid = _user_relationship_blocks_get_uid($delta)) {
     $account_loaded = user_load($uid);
     if ($account_loaded && user_relationships_ui_check_access('view', $account_loaded, user_relationships_type_load($rtid))) {
       $account = $account_loaded;
@@ -280,15 +280,15 @@ function user_relationship_blocks_block_info() {
     if ($type->is_oneway) {
       $extras = array(
         //add a little explanation about one-way relationships
-        UR_BLOCK_SEPARATOR .'you_to_them' => t('(You to Them, backward direction)'),
-        UR_BLOCK_SEPARATOR .'them_to_you' => t('(Them to You, normal direction)'),
+        UR_BLOCK_SEPARATOR . 'you_to_them' => t('(You to Them, backward direction)'),
+        UR_BLOCK_SEPARATOR . 'them_to_you' => t('(Them to You, normal direction)'),
       );
     }
 
     foreach ($extras as $token => $extra) {
       $block_types = array(
-        "{$my_delta}{$token}"   => t('My Relationships: @rel_name_plural @extra', array('@extra' => $extra) + user_relationships_type_translations($type)),
-        "{$usr_delta}{$token}"  => t('User Relationships: @rel_name_plural @extra', array('@extra' => $extra) + user_relationships_type_translations($type)),
+        "{$my_delta}{$token}" => t('My Relationships: @rel_name_plural @extra', array('@extra' => $extra) + user_relationships_type_translations($type)),
+        "{$usr_delta}{$token}" => t('User Relationships: @rel_name_plural @extra', array('@extra' => $extra) + user_relationships_type_translations($type)),
       );
       foreach ($block_types as $bid => $title) {
         $blocks[$bid] = array(
@@ -322,9 +322,9 @@ function user_relationship_blocks_block_save($delta = NULL, $edit = NULL) {
         'sort' => $edit['sort'],
       ))
       ->execute();
-    $settings[$delta] = (object)$edit;
+    $settings[$delta] = (object) $edit;
   }
-  else if ($delta && (!isset($settings[$delta]) || !$settings[$delta])) {
+  elseif ($delta && (!isset($settings[$delta]) || !$settings[$delta])) {
     $settings[$delta] = db_query("SELECT * FROM {user_relationship_blocks} WHERE bid = :bid", array(':bid' => $delta))->fetchObject();
     if (!$settings[$delta]) {
       // No overridden settings yet, return default array.
@@ -346,9 +346,9 @@ function user_relationship_blocks_block_save($delta = NULL, $edit = NULL) {
  * Template pre processor for the main block view
  */
 function template_preprocess_user_relationships_block(&$variables) {
-  $account  =& $variables['account'];
-  $settings =& $variables['settings'];
-  $extra    =& $variables['extra'];
+  $account  = &$variables['account'];
+  $settings = &$variables['settings'];
+  $extra    = &$variables['extra'];
 
   $query_opts = array('include_user_info' => TRUE);
 
@@ -361,9 +361,15 @@ function template_preprocess_user_relationships_block(&$variables) {
 
   // select the appropriate set of relationships based on admin's configuration settings
   switch ($settings->sort) {
-    case 'newest': $query_opts['order'] = array('changed', 'DESC'); break;
-    case 'oldest': $query_opts['order'] = array('changed', 'ASC'); break;
-    case 'random': $query_opts['order'] = 'RAND()'; break;
+    case 'newest':
+      $query_opts['order'] = array('changed', 'DESC');
+      break;
+    case 'oldest':
+      $query_opts['order'] = array('changed', 'ASC');
+      break;
+    case 'random':
+      $query_opts['order'] = 'RAND()';
+      break;
   }
 
   $query_opts['limit'] = $settings->size;
@@ -383,7 +389,7 @@ function template_preprocess_user_relationships_block(&$variables) {
  * Template pre processor for the pending relationships block
  */
 function template_preprocess_user_relationships_pending_block(&$variables) {
-  $account =& $variables['account'];
+  $account = &$variables['account'];
 
   $variables['relationships'] = user_relationships_load(array('user' => $account->uid, 'approved' => FALSE), array('include_user_info' => TRUE));
 }
@@ -393,8 +399,8 @@ function template_preprocess_user_relationships_pending_block(&$variables) {
  * Template pre processor for the relationship actions block
  */
 function template_preprocess_user_relationships_actions_block(&$variables) {
-  $user     =& $variables['user'];
-  $account  =& $variables['account'];
+  $user     = &$variables['user'];
+  $account  = &$variables['account'];
 
   if ($user != $account) {
     $variables['current_relationships'] = user_relationships_ui_actions_between($user, $account, array('remove' => 1));
diff --git a/user_relationship_defaults/user_relationship_defaults.module b/user_relationship_defaults/user_relationship_defaults.module
index cf59ce0..8e95b58 100644
--- a/user_relationship_defaults/user_relationship_defaults.module
+++ b/user_relationship_defaults/user_relationship_defaults.module
@@ -21,7 +21,7 @@
  * @return
  *   object of the default relationship with the user object and relationship_type object
  *
-*/
+ */
 function user_relationship_default_load($param = array()) {
   $defaults = user_relationship_defaults_load();
 
@@ -33,11 +33,11 @@ function user_relationship_default_load($param = array()) {
     $found = TRUE;
 
     foreach ($param as $column => $value) {
-      $column = strtolower($column);
+      $column = drupal_strtolower($column);
 
       if ($column == 'name' || $column == 'plural_name') {
-        $value = strtolower($value);
-        $col_val = strtolower($default->$column);
+        $value = drupal_strtolower($value);
+        $col_val = drupal_strtolower($default->$column);
       }
       else {
         $col_val = $default->$column;
@@ -77,7 +77,7 @@ function user_relationship_defaults_load($reset = FALSE) {
         continue;
       }
 
-      foreach ((array)$default->relationship_type as $column => $value) {
+      foreach ((array) $default->relationship_type as $column => $value) {
         $default->$column = $value;
       }
 
diff --git a/user_relationship_elaborations/user_relationship_elaborations.module b/user_relationship_elaborations/user_relationship_elaborations.module
index 83288e9..2f3d5e3 100644
--- a/user_relationship_elaborations/user_relationship_elaborations.module
+++ b/user_relationship_elaborations/user_relationship_elaborations.module
@@ -21,7 +21,7 @@
  */
 function user_relationships_save_elaboration($rid, $elaboration) {
   $record = array(
-    'rid'         => $rid,
+    'rid' => $rid,
     'elaboration' => $elaboration,
   );
 
@@ -62,7 +62,7 @@ function user_relationship_elaborations_user_relationships_delete($relationship,
 }
 
 /**
- * Implements hook_user_relationships_load()
+ * Implements hook_user_relationships_load().
  */
 function user_relationship_elaborations_user_relationships_load($relationships) {
   $rids = array();
diff --git a/user_relationship_elaborations/user_relationship_elaborations.views.inc b/user_relationship_elaborations/user_relationship_elaborations.views.inc
index aaaa541..113e6ed 100644
--- a/user_relationship_elaborations/user_relationship_elaborations.views.inc
+++ b/user_relationship_elaborations/user_relationship_elaborations.views.inc
@@ -17,8 +17,8 @@ function user_relationship_elaborations_views_data() {
           'table' => 'user_relationship_elaborations',
           'left_field' => 'rid',
           'field' => 'rid',
-         ),
-       ),
+        ),
+      ),
       'base' => array(
         'field' => 'rid',
         'title' => t('User relationship'),
diff --git a/user_relationship_implications/user_relationship_implications.module b/user_relationship_implications/user_relationship_implications.module
index c812225..564226b 100644
--- a/user_relationship_implications/user_relationship_implications.module
+++ b/user_relationship_implications/user_relationship_implications.module
@@ -124,8 +124,8 @@ function user_relationship_implications_edit_submit($form, &$form_state) {
       $implication = array(
         'rtid'          => $rtid,
         'implies_rtid'  => $implies_rtid,
-        'strict'        => (bool)$elements["implied_{$implies_rtid}_strict"],
-        'reverse'       => (bool)$elements["implied_{$implies_rtid}_reverse"],
+        'strict'        => (bool) $elements["implied_{$implies_rtid}_strict"],
+        'reverse'       => (bool) $elements["implied_{$implies_rtid}_reverse"],
       );
       drupal_write_record('user_relationship_implications', $implication);
     }
@@ -288,7 +288,7 @@ function theme_user_relationship_implications_page($variables) {
     $params['rtid'] = $relationship->rtid;
   }
 
-    // To Page or not to Page
+  // To Page or not to Page.
   $variables['relationships_per_page'] = variable_get('user_relationships_relationships_per_page', 16);
   $options = array('include_user_info' => TRUE, 'paging' => $variables['relationships_per_page']);
 
@@ -342,6 +342,6 @@ function _user_relationship_implications_load_relationship_names($relationships,
 
 
 function _user_relationship_implications_filter_for_reverse($implication) {
-  $implication = (array)$implication;
+  $implication = (array) $implication;
   return $implication['reverse'];
 }
diff --git a/user_relationship_invites/user_relationship_invites.module b/user_relationship_invites/user_relationship_invites.module
index 5ef4a8f..48049fa 100644
--- a/user_relationship_invites/user_relationship_invites.module
+++ b/user_relationship_invites/user_relationship_invites.module
@@ -17,7 +17,7 @@
  *
  * @return
  *    object with the invite data including the inviter user object and relationship_type object
-*/
+ */
 function user_relationship_invites_get_invite($code) {
   if ($invite = db_query("SELECT * FROM {user_relationship_invites} WHERE invite_code = :code", array(':code' => $code))->fetchObject()) {
     $invite->inviter = user_load($invite->inviter_uid);
@@ -29,7 +29,7 @@ function user_relationship_invites_get_invite($code) {
 
 /**
  * Implements hook_form_alter().
-*/
+ */
 function user_relationship_invites_form_invite_form_alter(&$form, $form_state) {
   global $user;
   $new_user = drupal_anonymous_user();
@@ -85,7 +85,7 @@ function user_relationship_invites_invite_form_validate($form, &$form_state) {
 
 /**
  * Implements hook_invite_send().
-*/
+ */
 function user_relationship_invites_invite_send($invite) {
   global $user;
   if (!empty($user->rtid)) {
@@ -101,7 +101,7 @@ function user_relationship_invites_invite_send($invite) {
 
 /**
  * Implements hook_user().
-*/
+ */
 function user_relationship_invites_form_user_register_form_alter(&$form, &$form_state) {
   if (!empty($_SESSION[INVITE_SESSION]) && ($code = $_SESSION[INVITE_SESSION]) && ($invite = user_relationship_invites_get_invite($code)) && $invite->relationship_type) {
 
diff --git a/user_relationship_mailer/user_relationship_mailer.module b/user_relationship_mailer/user_relationship_mailer.module
index a10346f..3a122ae 100644
--- a/user_relationship_mailer/user_relationship_mailer.module
+++ b/user_relationship_mailer/user_relationship_mailer.module
@@ -1,6 +1,7 @@
 <?php
 /**
- * @file User Relationships Mailer module. Handles email notifications when relationships are added or removed
+ * @file
+ * Handles email notifications when relationships are added or removed.
  */
 
 /**
@@ -102,14 +103,14 @@ function user_relationship_mailer_mail($op, &$message, $replacements) {
 }
 
 /**
- * Implements hook_user_relationships_save()
+ * Implements hook_user_relationships_save().
  */
 function user_relationship_mailer_user_relationships_save($relationship, $action) {
   user_relationship_mailer_send_email($action, $relationship);
 }
 
 /**
- * Implements hook_user_relationships_save()
+ * Implements hook_user_relationships_delete().
  */
 function user_relationship_mailer_user_relationships_delete($relationship, $action) {
   user_relationship_mailer_send_email($action, $relationship);
@@ -119,65 +120,65 @@ function user_relationship_mailer_user_relationships_delete($relationship, $acti
  * Implements hook_form_FORM_ID_alter().
  */
 function user_relationship_mailer_form_user_relationships_admin_settings_alter(&$form, &$form_state) {
-    global $_user_relationship_mailer_ops;
+  global $_user_relationship_mailer_ops;
 
-    $form['mail'] = array(
+  $form['mail'] = array(
       '#type'   => 'fieldset',
       '#title'  => t('E-mail Notification'),
       '#weight' => -9,
       '#group' => 'settings',
     );
-    $form['mail']['user_relationship_mailer_send_mail'] = array(
+  $form['mail']['user_relationship_mailer_send_mail'] = array(
       '#type'           => 'checkbox',
       '#title'          => t('Allow users to disable e-mail notifications'),
       '#default_value'  => variable_get('user_relationship_mailer_send_mail', FALSE),
       '#description'    => t('If checked, users can control e-mail notifications by changing a setting on their account edit page. If left unchecked, e-mail notifications will be sent to all users based on the global settings shown below.'),
     );
 
-    $form['mail']['mail_settings'] = array(
+  $form['mail']['mail_settings'] = array(
       '#type' => 'vertical_tabs',
     );
 
-    //compose a list of possible replacement keys for email templates
-    $replacement_keys = array_keys(user_relationship_mailer_replacements());
-    //these two are added per-recipient in user_relationship_mailer_send_email()
-    $replacement_keys[] = '@profile_uid';
-    $replacement_keys[] = '@target_name';
-    $macro_replacements = array('%macros' => implode(', ', $replacement_keys));
+  // Compose a list of possible replacement keys for email templates.
+  $replacement_keys = array_keys(user_relationship_mailer_replacements());
+  // These two are added per-recipient in user_relationship_mailer_send_email().
+  $replacement_keys[] = '@profile_uid';
+  $replacement_keys[] = '@target_name';
+  $macro_replacements = array('%macros' => implode(', ', $replacement_keys));
 
-    $translations = _user_relationship_mailer_ops_translations();
-    foreach ($_user_relationship_mailer_ops as $op) {
-      $defaults_function = "user_relationship_mailer_{$op}_default";
-      $defaults = $defaults_function();
+  $translations = _user_relationship_mailer_ops_translations();
+  foreach ($_user_relationship_mailer_ops as $op) {
+    $defaults_function = "user_relationship_mailer_{$op}_default";
+    $defaults = $defaults_function();
 
-      $op_translated = isset($translations[$op]) ? $translations[$op] : t(ucfirst(str_replace('_', '-', $op)));
-      $send_op_translated = isset($translations['send_'. $op]) ? $translations['send_'. $op] : t('Send @op messages', array('@op' => $op_translated));
-      $replacement_translations = t('Available tokens include: %macros', $macro_replacements);
+    $op_translated = isset($translations[$op]) ? $translations[$op] : t(drupal_ucfirst(str_replace('_', '-', $op)));
+    $send_op_translated = isset($translations['send_' . $op]) ? $translations['send_' . $op] : t('Send @op messages', array('@op' => $op_translated));
+    $replacement_translations = t('Available tokens include: %macros', $macro_replacements);
 
-      $form['mail'][$op] = array(
+    $form['mail'][$op] = array(
         '#type'         => 'fieldset',
         '#title'        => $op_translated,
         '#collapsible'  => TRUE,
         '#collapsed'    => TRUE,
         '#group'        => 'mail_settings',
       );
-      $form['mail'][$op]["user_relationship_mailer_send_{$op}"] = array(
+    $form['mail'][$op]["user_relationship_mailer_send_{$op}"] = array(
         '#type'           => 'checkbox',
         '#title'          => $send_op_translated,
         '#default_value'  => variable_get("user_relationship_mailer_send_{$op}", TRUE),
       );
-      $form['mail'][$op]["user_relationship_mailer_{$op}_subject"] = array(
+    $form['mail'][$op]["user_relationship_mailer_{$op}_subject"] = array(
         '#type'           => 'textfield',
         '#title'          => t('Email subject'),
         '#default_value'  => variable_get("user_relationship_mailer_{$op}_subject", $defaults['subject']),
       );
-      $form['mail'][$op]["user_relationship_mailer_{$op}_message"] = array(
+    $form['mail'][$op]["user_relationship_mailer_{$op}_message"] = array(
         '#type'           => 'textarea',
         '#title'          => t('Email message'),
         '#default_value'  => variable_get("user_relationship_mailer_{$op}_message", $defaults['message']),
         '#description'    => $replacement_translations,
       );
-    }
+  }
 }
 
 /**
diff --git a/user_relationship_node_access/user_relationship_node_access.module b/user_relationship_node_access/user_relationship_node_access.module
index 6a99be7..0f30705 100644
--- a/user_relationship_node_access/user_relationship_node_access.module
+++ b/user_relationship_node_access/user_relationship_node_access.module
@@ -31,8 +31,10 @@ function theme_user_relationship_node_access_form($arguments) {
   $form = $arguments['form'];
 
   $all_actions = array('view' => t('view'), 'update' => t('update'), 'delete' => t('delete'));
-  $actions = array();//allowed actions that will appear on the form
-  //#388726 IE7 will not like sticky javascript table headers, so construct the header as a regular row
+  // Allowed actions that will appear on the form.
+  $actions = array();
+  // #388726 IE7 will not like sticky javascript table headers, so construct the
+  // header as a regular row.
   $header = array(
     array(
       'data' => t('Relationship Type'),
@@ -87,7 +89,7 @@ function _user_relationship_node_access_disabling($set = NULL) {
 }
 
 /**
- * Implements hook_form_BASE_alter().
+ * Implements hook_form_BASE_FORM_ID_alter() for user_profile_form.
  */
 function user_relationship_node_access_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
   // Allow users to set default settings for sharing content.
@@ -111,7 +113,7 @@ function user_relationship_node_access_user_presave(&$edit, $account, $category)
 }
 
 /**
- * Implements hook_form_BASE_alter()
+ * Implements hook_form_BASE_FORM_ID_alter() for node_form.
  */
 function user_relationship_node_access_form_node_form_alter(&$form, &$form_state, $form_id) {
   // Verify we can set permissions on this node.
@@ -260,7 +262,7 @@ function user_relationship_node_access_perm() {
 }
 
 /**
- * Sitewide settings
+ * Sitewide settings.
  */
 function user_relationship_node_access_form_user_relationships_admin_settings_alter(&$form, &$form_state) {
   $form['node_access'] = array(
@@ -279,14 +281,14 @@ function user_relationship_node_access_form_user_relationships_admin_settings_al
 }
 
 /**
- * Implements hook_node_update()
+ * Implements hook_node_update().
  */
 function user_relationship_node_access_node_update($node) {
   user_relationship_node_access_update_node($node);
 }
 
 /**
- * Implements hook_node_insert()
+ * Implements hook_node_insert().
  */
 function user_relationship_node_access_node_insert($node) {
   user_relationship_node_access_update_node($node);
@@ -338,7 +340,7 @@ function user_relationship_node_access_update_node($node) {
 }
 
 /**
- * Implements hook_node_load()
+ * Implements hook_node_load().
  */
 function user_relationship_node_access_node_load($nodes, $types) {
   foreach ($nodes as $node) {
@@ -347,7 +349,7 @@ function user_relationship_node_access_node_load($nodes, $types) {
 }
 
 /**
- * Implements hook_node_delete()
+ * Implements hook_node_delete().
  */
 function user_relationship_node_access_node_delete($node) {
   db_delete('user_relationship_node_access')
@@ -357,7 +359,7 @@ function user_relationship_node_access_node_delete($node) {
 
 
 /**
- * Implements hook_node_grants()
+ * Implements hook_node_grants().
  */
 function user_relationship_node_access_node_grants($account, $op) {
   // get this user's relationships
@@ -404,9 +406,9 @@ function user_relationship_node_access_node_access_records($node) {
       $grants[] = array(
         'realm'         => "user_relationship_node_access_{$rtid}",
         'gid'           => $node->uid,
-        'grant_view'    => isset($permissions['view']) ? (int)$permissions['view'] : 0,
-        'grant_update'  => isset($permissions['update']) ? (int)$permissions['update'] : 0,
-        'grant_delete'  => isset($permissions['delete']) ? (int)$permissions['delete'] : 0,
+        'grant_view'    => isset($permissions['view']) ? (int) $permissions['view'] : 0,
+        'grant_update'  => isset($permissions['update']) ? (int) $permissions['update'] : 0,
+        'grant_delete'  => isset($permissions['delete']) ? (int) $permissions['delete'] : 0,
         'priority'      => 0,
       );
     }
@@ -427,9 +429,13 @@ function user_relationship_node_access_node_access_records($node) {
 }
 
 /**
- * Load UR-NA permissions for a node
- * @param $nid node ID
- * @return array {access key based on rtid} => {array of allowed actions on a node}
+ * Load UR-NA permissions for a node.
+ *
+ * @param $nid
+ *   node ID.
+ *
+ * @return
+ *   array {access key based on rtid} => {array of allowed actions on a node}.
  */
 function _user_relationship_node_access_load_node_perms($nid = NULL) {
   if (!$nid) {
@@ -442,8 +448,11 @@ function _user_relationship_node_access_load_node_perms($nid = NULL) {
 /**
  * Check if we are allowed to effect permissions on a node
  *
- * @param $node node to check
- * @return TRUE iff permissions on the node may be set for related users
+ * @param $node
+ *   node to check.
+ *
+ * @return
+ *   TRUE if permissions on the node may be set for related users
  */
 function _user_relationship_node_access_node_eligible($node) {
   $allowed_types = variable_get('user_relationship_node_access_allowed_types', array());
@@ -453,13 +462,15 @@ function _user_relationship_node_access_node_eligible($node) {
 /**
  * Find the list of permissions that a user is allowed to grant
  *
- * @param $user user to check, if not the current user
- * @return array of zero or more of ('view', 'update', 'delete')
+ * @param $account
+ *   user to check, if not the current user
+ * @return
+ *   array of zero or more of ('view', 'update', 'delete')
  */
-function _user_relationship_node_access_get_allowed_grants($user = NULL) {
+function _user_relationship_node_access_get_allowed_grants($account = NULL) {
   $allowed_grants = array();
   foreach (array('view', 'update', 'delete') as $type) {
-    if (user_access('grant ' . $type . ' permission to related users', $user)) {
+    if (user_access('grant ' . $type . ' permission to related users', $account)) {
       $allowed_grants[$type] = $type;
     }
   }
diff --git a/user_relationship_privatemsg/user_relationship_privatemsg.module b/user_relationship_privatemsg/user_relationship_privatemsg.module
index 2b2cd91..6fa8d36 100644
--- a/user_relationship_privatemsg/user_relationship_privatemsg.module
+++ b/user_relationship_privatemsg/user_relationship_privatemsg.module
@@ -317,7 +317,7 @@ function user_relationship_privatemsg_form_alter(&$form, &$form_state, $form_id)
         '#title' => t('Allow private messages from...'),
         '#description' => t('Choose who can send you private messages.'),
         '#options' => array('on all users' => t('Everyone'), 'on in relations' => t('Only those who have an established relationship with me')),
-        '#default_value' => !empty($form['#user']->data['user_relationships_allow_private_message'])? $form['#user']->data['user_relationships_allow_private_message'] : 'on all users',
+        '#default_value' => !empty($form['#user']->data['user_relationships_allow_private_message']) ? $form['#user']->data['user_relationships_allow_private_message'] : 'on all users',
         '#states' => array(
           'visible' => array(
             ':input[name="pm_enable"]' => array('checked' => TRUE),
diff --git a/user_relationship_privatemsg/user_relationship_privatemsg.test b/user_relationship_privatemsg/user_relationship_privatemsg.test
index 91cef9c..a8badb1 100644
--- a/user_relationship_privatemsg/user_relationship_privatemsg.test
+++ b/user_relationship_privatemsg/user_relationship_privatemsg.test
@@ -40,7 +40,7 @@ class UserRelationshipsPrivatemsgRecipientTestCase extends DrupalWebTestCase {
       'requires_approval' => FALSE,
       'expires_val' => 0,
     );
-    user_relationships_type_save((object)$relationship);
+    user_relationships_type_save((object) $relationship);
 
     // Flush permission cache.
     user_relationships_types_load(TRUE);
@@ -139,14 +139,14 @@ class UserRelationshipsPrivatemsgRecipientTestCase extends DrupalWebTestCase {
    */
   function testManyRelations() {
 
-        // Create relationship.
+    // Create relationship.
     $relationship = array(
       'name' => $this->randomName(),
       'plural_name' => $this->randomName(),
       'requires_approval' => FALSE,
       'expires_val' => 0,
     );
-    user_relationships_type_save((object)$relationship);
+    user_relationships_type_save((object) $relationship);
 
     // Flush permission cache.
     user_relationships_types_load(TRUE);
diff --git a/user_relationship_service/user_relationship_service.inc b/user_relationship_service/user_relationship_service.inc
index cad948e..ad32524 100644
--- a/user_relationship_service/user_relationship_service.inc
+++ b/user_relationship_service/user_relationship_service.inc
@@ -21,7 +21,8 @@ function user_relationship_service_mine($version) {
       throw new Exception("User relationship load failed");
     }
     return array_values($rels);
-  } catch (Exception $ex) {
+  }
+  catch (Exception $ex) {
     return services_error(t('Error getting user relationships: @msg', array('@msg' => $ex->getMessage())));
   }
 }
@@ -29,7 +30,7 @@ function user_relationship_service_mine($version) {
 function user_relationship_service_approve($version, $rid) {
   try {
     global $user;
-    $rels = user_relationships_load(array('rid' => $rid , 'requestee_id' => $user->uid, 'approved' => 0));
+    $rels = user_relationships_load(array('rid' => $rid, 'requestee_id' => $user->uid, 'approved' => 0));
     if (!$rels || !is_array($rels) || count($rels) != 1) {
       throw new Exception("User relationship load failed");
     }
@@ -39,7 +40,8 @@ function user_relationship_service_approve($version, $rid) {
     }
     user_relationships_save_relationship($rel, 'approve');
     return $rel;
-  } catch (Exception $ex) {
+  }
+  catch (Exception $ex) {
     return services_error(t('Error approving relationship: @msg', array('@msg' => $ex->getMessage())));
   }
 }
@@ -47,7 +49,7 @@ function user_relationship_service_approve($version, $rid) {
 function user_relationship_service_delete($version, $rid, $reason) {
   try {
     global $user;
-    $rels = user_relationships_load(array('rid' => $rid , 'user' => $user->uid));
+    $rels = user_relationships_load(array('rid' => $rid, 'user' => $user->uid));
     if (!$rels || !is_array($rels) || count($rels) != 1) {
       throw new Exception("User relationship load failed");
     }
@@ -57,7 +59,8 @@ function user_relationship_service_delete($version, $rid, $reason) {
     }
     user_relationships_delete_relationship($rel, $user, $reason);
     return $rel;
-  } catch (Exception $ex) {
+  }
+  catch (Exception $ex) {
     return services_error(t('Error removing relationship: @msg', array('@msg' => $ex->getMessage())));
   }
 }
@@ -79,7 +82,8 @@ function user_relationship_service_request($version, $uid, $type_name) {
       throw new Exception($ret);
     }
     return $ret;
-  } catch (Exception $ex) {
+  }
+  catch (Exception $ex) {
     return services_error(t('Error requesting relationship: @msg', array('@msg' => $ex->getMessage())));
   }
-}
\ No newline at end of file
+}
diff --git a/user_relationship_service/user_relationship_service.module b/user_relationship_service/user_relationship_service.module
index 22bbc95..02b79ec 100644
--- a/user_relationship_service/user_relationship_service.module
+++ b/user_relationship_service/user_relationship_service.module
@@ -3,8 +3,8 @@
  * @file
  * Link general user relationship functionalities to services module.
  *
- * @author Drupal 6 port by Darren Ferguson <http://drupal.org/user/70179>
- * @author Written by scottgifford http://drupal.org/user/245699 
+ * @author Drupal 6 port by Darren Ferguson <http://drupal.org/user/70179>.
+ * @author Written by scottgifford http://drupal.org/user/245699.
  */
 
 /**
@@ -13,7 +13,7 @@
 function user_relationship_service_help($path, $arg) {
   switch ($path) {
     case 'admin/help#services_user':
-      return '<p>'. t('Provides user relationship methods to services applications. Requires services.module.') .'</p>';
+      return '<p>' . t('Provides user relationship methods to services applications. Requires services.module.') . '</p>';
     case 'admin/modules#description':
       return t('Provides user relationship methods to services applications. Requires services.module.');
   }
diff --git a/user_relationship_views/user_relationship_views.module b/user_relationship_views/user_relationship_views.module
index 254d446..7a91d0c 100644
--- a/user_relationship_views/user_relationship_views.module
+++ b/user_relationship_views/user_relationship_views.module
@@ -43,7 +43,7 @@ function user_relationship_views_ajax_autocomplete_relationships_type($string =
   $last_string = trim(array_pop($array));
   $matches = array();
   if ($last_string != '') {
-    $prefix = count($array) ? implode(', ', $array) .', ' : '';
+    $prefix = count($array) ? implode(', ', $array) . ', ' : '';
 
 
     foreach (user_relationships_types_load() as $rtype) {
@@ -51,7 +51,7 @@ function user_relationship_views_ajax_autocomplete_relationships_type($string =
         $n = $rtype->name;
         // Commas and quotes in terms are special cases, so encode 'em.
         if (strpos($rtype->name, ',') !== FALSE || strpos($rtype->name, '"') !== FALSE) {
-          $n = '"'. str_replace('"', '""', $rtype->name) .'"';
+          $n = '"' . str_replace('"', '""', $rtype->name) . '"';
         }
         $matches[$prefix . $n] = check_plain(user_relationships_type_get_name($rtype));
       }
diff --git a/user_relationship_views/views_handler_field_user_relationships_status_link.inc b/user_relationship_views/views_handler_field_user_relationships_status_link.inc
index c6ffd15..e7a5344 100644
--- a/user_relationship_views/views_handler_field_user_relationships_status_link.inc
+++ b/user_relationship_views/views_handler_field_user_relationships_status_link.inc
@@ -36,8 +36,7 @@ class views_handler_field_user_relationships_status_link extends views_handler_f
       }
       //Accept or decline the request.
       else {
-        return
-        theme('user_relationships_pending_request_approve_link', array('uid' => $values->{$this->aliases['requestee_id']}, 'rid' => $values->{$this->aliases['rid']})) .
+        return theme('user_relationships_pending_request_approve_link', array('uid' => $values->{$this->aliases['requestee_id']}, 'rid' => $values->{$this->aliases['rid']})) .
         ' | ' .
         theme('user_relationships_pending_request_disapprove_link', array('uid' => $values->{$this->aliases['requestee_id']}, 'rid' => $values->{$this->aliases['rid']}));
       }
@@ -45,10 +44,10 @@ class views_handler_field_user_relationships_status_link extends views_handler_f
     //Requests by me.
     if ($values->{$this->aliases['requester_id']} === $user->uid) {
       if ($values->{$this->aliases['approved']}) {
-        return theme('user_relationships_remove_link', array('uid' => $values->{$this->aliases['requestee_id']}, 'rid' => $values->{$this->aliases['rid']})) ;
+        return theme('user_relationships_remove_link', array('uid' => $values->{$this->aliases['requestee_id']}, 'rid' => $values->{$this->aliases['rid']}));
       }
       else {
-        return theme('user_relationships_pending_request_cancel_link', array('uid' => $values->{$this->aliases['requestee_id']}, 'rid' => $values->{$this->aliases['rid']})) ;
+        return theme('user_relationships_pending_request_cancel_link', array('uid' => $values->{$this->aliases['requestee_id']}, 'rid' => $values->{$this->aliases['rid']}));
       }
     }
   }
diff --git a/user_relationships.admin.inc b/user_relationships.admin.inc
index 0486ad7..e0505f6 100644
--- a/user_relationships.admin.inc
+++ b/user_relationships.admin.inc
@@ -301,7 +301,7 @@ function user_relationships_admin_type_edit($form, &$form_state, $relationship_t
 
   $form['rtid'] = array(
     '#type'   => 'value',
-    '#value'  => isset($relationship_type->rtid) ? (int)$relationship_type->rtid : NULL,
+    '#value'  => isset($relationship_type->rtid) ? (int) $relationship_type->rtid : NULL,
   );
   $form['action'] = array(
     '#type'   => 'value',
@@ -335,7 +335,7 @@ function user_relationships_admin_type_delete($form, &$form_state, $relationship
   if ($relationship_type) {
     $form['rtid'] = array(
       '#type'   => 'value',
-      '#value'  => (int)$relationship_type->rtid,
+      '#value'  => (int) $relationship_type->rtid,
     );
 
     return confirm_form(
@@ -367,7 +367,7 @@ function user_relationships_admin_type_edit_validate($form, &$form_state) {
   }
 
   $expire = $form_state['values']['expires_val'];
-  if (!is_numeric($expire) || (int)$expire < 0) {
+  if (!is_numeric($expire) || (int) $expire < 0) {
     form_set_error('expires_val', t('Expiration period must be an integer greater than or equal to 0.'));
   }
 }
@@ -376,7 +376,7 @@ function user_relationships_admin_type_edit_validate($form, &$form_state) {
  * Process the relationship edit page form submission.
  */
 function user_relationships_admin_type_edit_submit($form, &$form_state) {
-  $relationship_type = (object)$form_state['values'];
+  $relationship_type = (object) $form_state['values'];
 
   user_relationships_type_save($relationship_type);
 
@@ -453,8 +453,8 @@ function user_relationships_admin_types_list_page() {
       user_relationships_type_get_name($relationship),
       ($relationship->is_oneway ? ($relationship->is_reciprocal ? t('Reciprocal') : t('One-way')) : t('Mutual')),
       $approval,
-      l(t('edit'),    "admin/config/people/relationships/{$relationship->rtid}/edit") . ' | ' .
-      l(t('delete'),  "admin/config/people/relationships/{$relationship->rtid}/delete")
+      l(t('edit'),     "admin/config/people/relationships/{$relationship->rtid}/edit") . ' | ' .
+      l(t('delete'),   "admin/config/people/relationships/{$relationship->rtid}/delete")
     );
   }
 
diff --git a/user_relationships.api.php b/user_relationships.api.php
index 490945e..0e0ee23 100644
--- a/user_relationships.api.php
+++ b/user_relationships.api.php
@@ -156,4 +156,4 @@ function hook_user_relationships_types_list_alter(&$page) {
     '#rows' => $default_rows,
     '#empty' => t('No default relationships available.'),
   );
-}
\ No newline at end of file
+}
diff --git a/user_relationships.author-pane.inc b/user_relationships.author-pane.inc
index 359cb2a..c58f87c 100644
--- a/user_relationships.author-pane.inc
+++ b/user_relationships.author-pane.inc
@@ -25,7 +25,8 @@ function user_relationships_preprocess_author_pane(&$variables) {
 
   $rtids = variable_get('user_relationships_author_pane_rtids', array());
   if (!is_array($rtids)) {
-    $rtids = array($rtids);//wrap into array for now, while selection is single
+    // Wrap into array for now, while selection is single.
+    $rtids = array($rtids);
   }
   if (!count($rtids)) {
     return;
diff --git a/user_relationships.i18n.inc b/user_relationships.i18n.inc
index f22b4ba..27c5a10 100644
--- a/user_relationships.i18n.inc
+++ b/user_relationships.i18n.inc
@@ -61,4 +61,4 @@ function user_relationships_i18n_object_info() {
     )
   );
   return $info;
-}
\ No newline at end of file
+}
diff --git a/user_relationships.module b/user_relationships.module
index 87fed87..e40ed1d 100644
--- a/user_relationships.module
+++ b/user_relationships.module
@@ -15,6 +15,9 @@ define('USER_RELATIONSHIPS_NAME_PLURAL', 1);
 define('USER_RELATIONSHIPS_NAME_CAPITAL', 2);
 define('USER_RELATIONSHIPS_NAME_REVERSE', 4);
 
+/**
+ * Implements hook_menu().
+ */
 function user_relationships_menu() {
   $items['admin/config/people/relationships'] = array(
     'title' => 'Relationships',
@@ -86,8 +89,8 @@ function user_relationships_setting_validation($element, $validations) {
     }
 
     $valid = function_exists($validation) && call_user_func_array($validation, $arguments);
-    $valid = !$valid ? ($validation == 'is_positive' && is_numeric($arguments) && (int)$arguments > 0) : FALSE;
-    $valid = !$valid ? ($validation == 'is_non_negative' && is_numeric($arguments) && (int)$arguments > -1) : FALSE;
+    $valid = !$valid ? ($validation == 'is_positive' && is_numeric($arguments) && (int) $arguments > 0) : FALSE;
+    $valid = !$valid ? ($validation == 'is_non_negative' && is_numeric($arguments) && (int) $arguments > -1) : FALSE;
 
     if (!$valid) {
       form_set_error($element['#name'], $info['msg']);
@@ -102,7 +105,8 @@ function user_relationships_setting_validation($element, $validations) {
 function _user_relationships_generate_query($param = array(), $options = array()) {
   extract($options, EXTR_SKIP);
 
-  $twoway_reverse_clause = FALSE;//#479486
+  // #479486.
+  $twoway_reverse_clause = FALSE;
 
   // Doing a JOIN on the {user_relationship_types} table is rather slow as
   // MySQL has to use ALL for the table join. On most sites, there will only be
@@ -198,7 +202,8 @@ function _user_relationships_generate_query($param = array(), $options = array()
       case 'rid':
       case 'requester_id':
       case 'requestee_id':
-        $twoway_reverse_clause = TRUE;//#479486 these columns automatically should exclude duplicates
+        // #479486 these columns automatically should exclude duplicates.
+        $twoway_reverse_clause = TRUE;
 
       default:
         $types_cols = array('name', 'plural_name', 'is_oneway', 'is_reciprocal', 'requires_approval', 'expires_val');
@@ -347,7 +352,7 @@ function user_relationships_cron() {
  * Implements hook_user_cancel().
  */
 function user_relationships_user_cancel($edit, $account, $method) {
-    db_delete('user_relationships')
+  db_delete('user_relationships')
       ->condition(db_or()
         ->condition('requester_id', $account->uid)
         ->condition('requestee_id', $account->uid)
@@ -697,60 +702,60 @@ function user_relationships_delete_relationship($relationship, $deleted_by, $act
 
 
 /**
-  * Load relationship objects from the database.
-  *
-  * @param $param
-  *   an array of parameters with the key being the column. columns from both the user_relationships and user_relationship_types tables will work
-  *     columns from user_relationships: rid, requester_id, requestee_id, rtid, approved, created, changed, flags
-  *     columns from user_relationship_types: name, plural_name, is_oneway, requires_approval, expires_val
-  *   There are two special keys:
-  *     1) array("between" => array($uid1, $uid2)) will return all relationships between the two user ids.
-  *     2) array("user" => $uid) will return all relationships for the specified uid
-  *
-  *   arguments will process operators as well using the syntax: array(col => '> {value}').
-  *     example: show all relationships created in 2007
-  *       $start_time = mktime(0,0,0,0,0,2007);
-  *       $end_time = mktime(0,0,0,0,0,2008);
-  *       user_relationships_load(array('created' => ">= {$start_time}", 'created' => '< {$end_time'}));
-  *
-  *   each parameter may be an array, if you wish to pass several values
-  *     example: user_relationships_load(array('rtid' => array(2, 3), 'between' => array($uid1, $uid2)))
-  *       will load all relationships of types 2 or 3 between uid1 and uid2 (query will have an IN clause)
-  *
-  * @param @options
-  *   An array keyed by the option
-  *   count
-  *     a boolean stating whether or not the return value should be the number of relationships found
-  *
-  *   sort
-  *     a string containing a valid column name which will become the key for the returned array of relationships
-  *     default is 'rid'
-  *
-  *   order
-  *     a string containing SQL stating the column and direction of the sort (ex. "requester_id ASC, rtid DESC")
-  *
-  *   limit
-  *     a string containing SQL stating the limit (ex "10" or "10, 5")
-  *
-  *   include_user_info
-  *     a boolean that will load basic user info without having to call user_load
-  *     columns: uid, name, mail, data, picture
-  *
-  *   include_twoway_reverse (not used unless there is a specific need)
-  *     a boolean that, if present, and if sort is set to other than 'rid', will include records for both directions for
-  *     two-way relationships. Normally for a two-way relationship only one entry is returned, although in the database there
-  *     are two records. This flag has no effect if sort is 'rid'
-  *
-  * @param $reset
-  *   a boolean that will reset the internal static $relationships variable to ensure programmatic relationship insertion works
-  *
-  * @return
-  *   an array of relationships
-  *   if the key is "rid" the array will be a single dimension: array($rid => $relationship, $rid => $relationship)
-  *   otherwise it'll be multidimensional: array($rtid => array($relationship, $relationship))
-  *
-  *   each relationship will have the user's name, mail, and data attached as requester_name, requester_mail, requester_data
-  *   or requestee_name, requestee_mail, requestee_data
+ * Load relationship objects from the database.
+ *
+ * @param $param
+ *   an array of parameters with the key being the column. columns from both the user_relationships and user_relationship_types tables will work
+ *     columns from user_relationships: rid, requester_id, requestee_id, rtid, approved, created, changed, flags
+ *     columns from user_relationship_types: name, plural_name, is_oneway, requires_approval, expires_val
+ *   There are two special keys:
+ *     1) array("between" => array($uid1, $uid2)) will return all relationships between the two user ids.
+ *     2) array("user" => $uid) will return all relationships for the specified uid
+ *
+ *   arguments will process operators as well using the syntax: array(col => '> {value}').
+ *     example: show all relationships created in 2007
+ *       $start_time = mktime(0,0,0,0,0,2007);
+ *       $end_time = mktime(0,0,0,0,0,2008);
+ *       user_relationships_load(array('created' => ">= {$start_time}", 'created' => '< {$end_time'}));
+ *
+ *   each parameter may be an array, if you wish to pass several values
+ *     example: user_relationships_load(array('rtid' => array(2, 3), 'between' => array($uid1, $uid2)))
+ *       will load all relationships of types 2 or 3 between uid1 and uid2 (query will have an IN clause)
+ *
+ * @param @options
+ *   An array keyed by the option
+ *   count
+ *     a boolean stating whether or not the return value should be the number of relationships found
+ *
+ *   sort
+ *     a string containing a valid column name which will become the key for the returned array of relationships
+ *     default is 'rid'
+ *
+ *   order
+ *     a string containing SQL stating the column and direction of the sort (ex. "requester_id ASC, rtid DESC")
+ *
+ *   limit
+ *     a string containing SQL stating the limit (ex "10" or "10, 5")
+ *
+ *   include_user_info
+ *     a boolean that will load basic user info without having to call user_load
+ *     columns: uid, name, mail, data, picture
+ *
+ *   include_twoway_reverse (not used unless there is a specific need)
+ *     a boolean that, if present, and if sort is set to other than 'rid', will include records for both directions for
+ *     two-way relationships. Normally for a two-way relationship only one entry is returned, although in the database there
+ *     are two records. This flag has no effect if sort is 'rid'
+ *
+ * @param $reset
+ *   a boolean that will reset the internal static $relationships variable to ensure programmatic relationship insertion works
+ *
+ * @return
+ *   an array of relationships
+ *   if the key is "rid" the array will be a single dimension: array($rid => $relationship, $rid => $relationship)
+ *   otherwise it'll be multidimensional: array($rtid => array($relationship, $relationship))
+ *
+ *   each relationship will have the user's name, mail, and data attached as requester_name, requester_mail, requester_data
+ *   or requestee_name, requestee_mail, requestee_data
  */
 function user_relationships_load($param = array(), $options = array(), $reset = FALSE) {
   static $relationships = array();
@@ -774,7 +779,7 @@ function user_relationships_load($param = array(), $options = array(), $reset =
   $query = _user_relationships_generate_query($param, $options);
 
   if (!empty($count)) {
-    return (int)$query->execute()->fetchField();
+    return (int) $query->execute()->fetchField();
   }
 
   $relationships = array();
@@ -1090,7 +1095,7 @@ function user_relationships_autocomplete_types($string = '') {
     $result = db_query_range("SELECT rtid, name FROM {user_relationship_types} WHERE LOWER(name) LIKE LOWER(:string)", 0, 10, array(':string' => '%' . strtolower($string) . '%'));
     foreach ($result as $relationship) {
       $matches[$relationship->name] = check_plain(user_relationships_type_get_name($relationship));
-   }
+    }
   }
   print drupal_json_output($matches);
 }
diff --git a/user_relationships.test b/user_relationships.test
index 0b52c0f..32635a6 100644
--- a/user_relationships.test
+++ b/user_relationships.test
@@ -178,7 +178,7 @@ class UserRelationshipsTestCase extends UserRelationshipsBaseTestCase {
   function testRelationshipAPI() {
     $this->createDefaultRelationshipTypes();
 
-     $permissions = array(
+    $permissions = array(
       'can have ' . $this->rtypes['oneway']->name . ' relationships',
       'can request ' . $this->rtypes['oneway']->name . ' relationships',
       'can have ' . $this->rtypes['twoway']->name . ' relationships',
@@ -291,13 +291,13 @@ class UserRelationshipsTestCase extends UserRelationshipsBaseTestCase {
     $u3 = $this->drupalCreateUser($permissions);
     $u4 = $this->drupalCreateUser($permissions);
     // Create relationships.
-    $this->assertTrue((bool)user_relationships_request_relationship($u1, $u2, $this->rtypes['oneway']->rtid, FALSE));
-    $this->assertTrue((bool)user_relationships_request_relationship($u1, $u3, $this->rtypes['oneway']->rtid, FALSE));
+    $this->assertTrue((bool) user_relationships_request_relationship($u1, $u2, $this->rtypes['oneway']->rtid, FALSE));
+    $this->assertTrue((bool) user_relationships_request_relationship($u1, $u3, $this->rtypes['oneway']->rtid, FALSE));
     // user_relationships_request_relationship($u3, $u1, $this->rtypes['oneway']->rtid, FALSE);//this is a no-op
 
-    $this->assertTrue((bool)user_relationships_request_relationship($u1, $u2, $this->rtypes['twoway']->rtid, FALSE));
-    $this->assertTrue((bool)user_relationships_request_relationship($u1, $u3, $this->rtypes['twoway']->rtid, FALSE));
-    $this->assertTrue((bool)user_relationships_request_relationship($u4, $u1, $this->rtypes['twoway']->rtid, FALSE));
+    $this->assertTrue((bool) user_relationships_request_relationship($u1, $u2, $this->rtypes['twoway']->rtid, FALSE));
+    $this->assertTrue((bool) user_relationships_request_relationship($u1, $u3, $this->rtypes['twoway']->rtid, FALSE));
+    $this->assertTrue((bool) user_relationships_request_relationship($u4, $u1, $this->rtypes['twoway']->rtid, FALSE));
     //test between
     $result = user_relationships_load(array('between' => array($u1->uid, $u2->uid)));
     $this->assertEqual(count($result), 2);
@@ -480,7 +480,7 @@ class UserRelationshipsTestCase extends UserRelationshipsBaseTestCase {
     $rtype = $rtypes[$this->rtypes['approval-oneway']->rtid];
     $this->assertFalse($rtype->is_reciprocal);
     $rtype = $rtypes[$this->rtypes['approval']->rtid];
-    $this-> assertFalse($rtype->is_reciprocal);
+    $this->assertFalse($rtype->is_reciprocal);
   }
 }
 
@@ -509,7 +509,7 @@ class UserRelationshipsTypesTestCase extends DrupalWebTestCase {
 
   function testNames() {
     // Create relationship type.
-    $relationship_type = (object)array(
+    $relationship_type = (object) array(
       'name' => $this->randomName(),
       'plural_name' => $this->randomName(),
       'reverse_name' => $this->randomName(),
@@ -642,4 +642,4 @@ class UserRelationshipsI18nTestCase extends DrupalWebTestCase {
     $this->assertNoText($edit['plural_name_capitalized']);
     $this->assertText($translations["strings[user_relationships:type:$rtid:plural_name_capitalized]"]);
   }
-}
\ No newline at end of file
+}
diff --git a/user_relationships_panels_visibility/plugins/access/ur_relationship.inc b/user_relationships_panels_visibility/plugins/access/ur_relationship.inc
index 6bd9c94..437f903 100644
--- a/user_relationships_panels_visibility/plugins/access/ur_relationship.inc
+++ b/user_relationships_panels_visibility/plugins/access/ur_relationship.inc
@@ -57,7 +57,7 @@ function user_relationships_panels_visibility_ctools_access_check($conf, $contex
   $account2 = $context[1]->data;
 
   // If you are viewing something which is your own (like your profile) return TRUE.
-  if($conf['ur_self']['1'] == 1 && $account1->uid == $account2->uid) {
+  if ($conf['ur_self']['1'] == 1 && $account1->uid == $account2->uid) {
     return TRUE;
   }
 
diff --git a/user_relationships_panels_visibility/user_relationships_panels_visibility.module b/user_relationships_panels_visibility/user_relationships_panels_visibility.module
index 7a34604..83a32aa 100644
--- a/user_relationships_panels_visibility/user_relationships_panels_visibility.module
+++ b/user_relationships_panels_visibility/user_relationships_panels_visibility.module
@@ -4,7 +4,7 @@
  * @file
  * Module to provide a ctools access plugin
  *
-*/
+ */
 
 
 function user_relationships_panels_visibility_ctools_plugin_directory($module, $plugin) {
diff --git a/user_relationships_rules/user_relationships_rules.module b/user_relationships_rules/user_relationships_rules.module
index aebf5ed..e5c85c4 100755
--- a/user_relationships_rules/user_relationships_rules.module
+++ b/user_relationships_rules/user_relationships_rules.module
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * Implements hook_user_relationships_save()
+ * Implements hook_user_relationships_save().
  */
 function user_relationships_rules_user_relationships_save($relationship, $action) {
   switch ($action) {
@@ -13,7 +13,7 @@ function user_relationships_rules_user_relationships_save($relationship, $action
 }
 
 /**
- * Implements hook_user_relationships_delete()
+ * Implements hook_user_relationships_delete().
  */
 function user_relationships_rules_user_relationships_delete($relationship, $action) {
   switch ($action) {
@@ -23,4 +23,4 @@ function user_relationships_rules_user_relationships_delete($relationship, $acti
       rules_invoke_event('user_relationships_' . $action, user_load($relationship->requester_id), user_load($relationship->requestee_id), $relationship);
       break;
   }
-}
\ No newline at end of file
+}
diff --git a/user_relationships_rules/user_relationships_rules.rules.inc b/user_relationships_rules/user_relationships_rules.rules.inc
index aaa2004..fd3c842 100755
--- a/user_relationships_rules/user_relationships_rules.rules.inc
+++ b/user_relationships_rules/user_relationships_rules.rules.inc
@@ -140,9 +140,9 @@ function user_relationships_rules_rules_event_info() {
       'label' => t('A user relationship has been removed'),
       'group' => t('Relationships'),
       'arguments' => array(
-        'requester'   => array('type' => 'user',  'label' => t('User who initiated the request')),
-        'requestee'   => array('type' => 'user',  'label' => t('User whose relationship is requested')),
-        'relationship' => array('type' => 'relationship',  'label' => t('The relationship object'))
+        'requester'   => array('type' => 'user',   'label' => t('User who initiated the request')),
+        'requestee'   => array('type' => 'user',   'label' => t('User whose relationship is requested')),
+        'relationship' => array('type' => 'relationship',   'label' => t('The relationship object'))
       )
     ),
   );
@@ -189,7 +189,8 @@ function user_relationships_rules_action_delete_relationship($settings) {
     'requestee_id' => $settings['requestee'] instanceof EntityDrupalWrapper ? $settings['requestee']->getIdentifier() : $settings['requestee']->uid,
     'rtid' => $settings['relationship_type'],
   );
-  $existing = user_relationships_load($args);// finding rid - this method can probably be made better
+  // Finding rid - this method can probably be made better.
+  $existing = user_relationships_load($args);
   if ($relationship = reset($existing)) {
     $deleted_by = $settings['requester'] instanceof EntityDrupalWrapper ? user_load($settings['requester']->getIdentifier()) : $settings['requester'];
     user_relationships_delete_relationship($relationship, $deleted_by, 'remove');
diff --git a/user_relationships_ui/user_relationships_ui.actions.inc b/user_relationships_ui/user_relationships_ui.actions.inc
index 221e232..87cca87 100644
--- a/user_relationships_ui/user_relationships_ui.actions.inc
+++ b/user_relationships_ui/user_relationships_ui.actions.inc
@@ -19,7 +19,7 @@ function user_relationships_ui_request_validate($form, &$form_state) {
   $current_relationships = user_relationships_load(array('between' => array($requester->uid, $requestee->uid)), array('sort' => 'rtid'));
   //check for multiple relationships
   if (!variable_get('user_relationships_allow_multiple', TRUE) && count($current_relationships)) {
-  form_set_error('rtid', user_relationships_get_message('too_many_relationships'));
+    form_set_error('rtid', user_relationships_get_message('too_many_relationships'));
     if (isset($_GET['ajax'])) {
       drupal_goto();
     }
@@ -60,17 +60,17 @@ function user_relationships_ui_request_validate($form, &$form_state) {
     foreach ($value as $val_rel) {
       //existing two way relationships count no matter the direction
       if (!$val_rel->is_oneway) {
-        $test_relationships[$key]=$key;
+        $test_relationships[$key] = $key;
         continue;
       }
       //if it's one way, but not reciprocal, then it counts no matter the direction
       if (!$val_rel->is_reciprocal) {
-        $test_relationships[$key]=$key;
+        $test_relationships[$key] = $key;
         continue;
       }
       //remaining case is a reciprocal relationship - it counts unless the request is in the opposite direction
       if ($requester->uid == $val_rel->requester_id) {
-        $test_relationships[$key]=$key;
+        $test_relationships[$key] = $key;
       }
     }
   }
@@ -128,36 +128,36 @@ function user_relationships_ui_pending_requested_submit($form, &$form_state) {
   $requestee    = $relationship->requestee;
 
   switch ($form_state['values']['action']) {
-  case 'approve':
-    if (!user_relationships_ui_check_access('approve', NULL, $relationship)) {
-      drupal_access_denied();
-      exit();
-    }
-    $relationship->approved = TRUE;
-    user_relationships_save_relationship($relationship, $form_state['values']['action']);
-    drupal_set_message(user_relationships_get_message('accepted', $relationship));
-    break;
-
-  case 'cancel':
-    if (!user_relationships_ui_check_access('request', NULL, $relationship)) {
-      drupal_access_denied();
-      exit();
-    }
-    user_relationships_delete_relationship($relationship, $user, $form_state['values']['action']);
-    drupal_set_message(user_relationships_get_message($form_state['values']['action'], $relationship));
-    break;
-
-  case 'disapprove':
-    if (!user_relationships_ui_check_access('approve', NULL, $relationship)) {
-      drupal_access_denied();
-      exit();
-    }
-    user_relationships_delete_relationship($relationship, $user, $form_state['values']['action']);
-    drupal_set_message(user_relationships_get_message($form_state['values']['action'], $relationship));
-    break;
+    case 'approve':
+      if (!user_relationships_ui_check_access('approve', NULL, $relationship)) {
+        drupal_access_denied();
+        exit();
+      }
+      $relationship->approved = TRUE;
+      user_relationships_save_relationship($relationship, $form_state['values']['action']);
+      drupal_set_message(user_relationships_get_message('accepted', $relationship));
+      break;
+
+    case 'cancel':
+      if (!user_relationships_ui_check_access('request', NULL, $relationship)) {
+        drupal_access_denied();
+        exit();
+      }
+      user_relationships_delete_relationship($relationship, $user, $form_state['values']['action']);
+      drupal_set_message(user_relationships_get_message($form_state['values']['action'], $relationship));
+      break;
+
+    case 'disapprove':
+      if (!user_relationships_ui_check_access('approve', NULL, $relationship)) {
+        drupal_access_denied();
+        exit();
+      }
+      user_relationships_delete_relationship($relationship, $user, $form_state['values']['action']);
+      drupal_set_message(user_relationships_get_message($form_state['values']['action'], $relationship));
+      break;
 
-  default:
-    drupal_set_message(user_relationships_get_message('default'));
+    default:
+      drupal_set_message(user_relationships_get_message('default'));
   }
 
   $form_state['redirect'] = str_replace('destination=', '', drupal_get_destination());
diff --git a/user_relationships_ui/user_relationships_ui.api.php b/user_relationships_ui/user_relationships_ui.api.php
index e11d385..6b84fee 100644
--- a/user_relationships_ui/user_relationships_ui.api.php
+++ b/user_relationships_ui/user_relationships_ui.api.php
@@ -35,4 +35,4 @@ function hook_user_relationships_ui_table_header_alter(&$header, $edit_access) {
 function user_relationship_elaborations_user_relationships_ui_table_row_alter(&$row, $relationship, $account) {
   $insert_index = variable_get('user_relationships_show_user_pictures', 0) + 2;
   $row = array_merge(array_slice($row, 0, $insert_index), array($relationship->elaboration), array_slice($row, $insert_index));
-}
\ No newline at end of file
+}
diff --git a/user_relationships_ui/user_relationships_ui.forms.inc b/user_relationships_ui/user_relationships_ui.forms.inc
index f253653..85422b8 100644
--- a/user_relationships_ui/user_relationships_ui.forms.inc
+++ b/user_relationships_ui/user_relationships_ui.forms.inc
@@ -14,24 +14,27 @@ module_load_include('inc', 'user_relationships_ui', 'user_relationships_ui.actio
  */
 function user_relationships_ui_request_form($requester, $requestee, $form_values = NULL) {
   $relationships = user_relationships_get_requestable_rtypes($requester, $requestee);
-  //try to find out desired relationship type
+  // Try to find out desired relationship type.
   $default_relationship = NULL;
-  if (isset($form_values['rtid'])) {//given through form
+  // Given through form.
+  if (isset($form_values['rtid'])) {
     $default_relationship = $form_values['rtid'];
   }
-  elseif (is_numeric(arg(3)) && user_relationships_type_load(arg(3))) {//given through URL arguments, e.g. relationship/{uid}/request/{rtid}
+  // Given through URL arguments, e.g. relationship/{uid}/request/{rtid}.
+  elseif (is_numeric(arg(3)) && user_relationships_type_load(arg(3))) {
     $default_relationship = arg(3);
   }
-  elseif (count($relationships) == 1) {//preselect the only one.
+  // Preselect the only one.
+  elseif (count($relationships) == 1) {
     $rtids = array_keys($relationships);
     $default_relationship = $rtids[0];
   }
 
-  //verify default relationship may be requested
+  // Verify default relationship may be requested.
   $default_relationship = isset($relationships[$default_relationship]) ? $default_relationship : NULL;
 
   if (count($relationships)) {
-    //hide control if the relationship is chosen
+    // Hide control if the relationship is chosen.
     if ($default_relationship && variable_get('user_relationships_show_direct_links', 1)) {
       $form['rtid'] = array(
         '#type' => 'hidden',
@@ -179,7 +182,8 @@ function user_relationships_ui_pending_requested($form, &$form_state, $action, $
     '#value'  => $viewed_id
   );
 
-  //pick the correct question message: approve and disapprove are requests to current user, cancel is a request from current user
+  // Pick the correct question message: approve and disapprove are requests to
+  // current user, cancel is a request from current user.
   switch ($action) {
     case 'approve':
       $confirmation_message = t('Are you sure you want to approve the @rel_name relationship request from !name?', array(
@@ -206,7 +210,7 @@ function user_relationships_ui_pending_requested($form, &$form_state, $action, $
       $request_url = 'relationships/sent';
   }
 
-  // http://drupal.org/node/489954 respect destination param if given
+  // http://drupal.org/node/489954 respect destination param if given.
   if (isset($_GET['destination'])) {
     $dest = $_GET['destination'];
   }
@@ -232,7 +236,7 @@ function user_relationships_ui_pending_requested($form, &$form_state, $action, $
  * in a popup rather than having the full page reload for the users
  */
 function user_relationships_ui_remove_ajax($account, $relationship) {
-  //#382668 makes sure a valid relationship id was supplied
+  // #382668 makes sure a valid relationship id was supplied.
   if (!$relationship->rid) {
     if (isset($_GET['ajax'])) {
       print '';
diff --git a/user_relationships_ui/user_relationships_ui.module b/user_relationships_ui/user_relationships_ui.module
index 1379954..73b0b26 100644
--- a/user_relationships_ui/user_relationships_ui.module
+++ b/user_relationships_ui/user_relationships_ui.module
@@ -189,11 +189,11 @@ function user_relationships_ui_check_access($type, $account = NULL, $relationshi
 function user_relationships_ui_help($section) {
   switch ($section) {
     case 'admin/help#user_relationships_ui':
-      $output = '<p>'. t('This module allows you to create relationship types that users can use to connect to each other.') .'</p>';
+      $output = '<p>' . t('This module allows you to create relationship types that users can use to connect to each other.') . '</p>';
       return $output;
 
     case 'admin/config/people/relationships':
-      $output = '<p>'. t('This page lets you setup user relationship types.') .'</p>';
+      $output = '<p>' . t('This page lets you setup user relationship types.') . '</p>';
       return $output;
   }
 }
@@ -206,10 +206,10 @@ function user_relationships_ui_init() {
   if (!variable_get('user_relationships_enable_ajax_popups', 0)) {
     return;
   }
-  drupal_add_js(USER_RELATIONSHIPS_UI_PATH .'/user_relationships_ui.js');
-  drupal_add_css(USER_RELATIONSHIPS_UI_PATH .'/user_relationships_ui.css');
-  $settings['user_relationships_ui']['loadingimage'] = url(USER_RELATIONSHIPS_UI_PATH .'/images/loadingAnimation.gif');
-  $settings['user_relationships_ui']['savingimage'] = url(USER_RELATIONSHIPS_UI_PATH .'/images/savingimage.gif');
+  drupal_add_js(USER_RELATIONSHIPS_UI_PATH . '/user_relationships_ui.js');
+  drupal_add_css(USER_RELATIONSHIPS_UI_PATH . '/user_relationships_ui.css');
+  $settings['user_relationships_ui']['loadingimage'] = url(USER_RELATIONSHIPS_UI_PATH . '/images/loadingAnimation.gif');
+  $settings['user_relationships_ui']['savingimage'] = url(USER_RELATIONSHIPS_UI_PATH . '/images/savingimage.gif');
   $settings['user_relationships_ui']['position'] = array(
     'position' => variable_get('user_relationships_position', 'absolute'),
     'left' => variable_get('user_relationships_left', '0'),
@@ -447,7 +447,7 @@ function user_relationships_ui_title_callback_pending($column, $account = NULL)
  * Implements hook_user_login().
  */
 function user_relationships_ui_user_login(&$edit, $account) {
-   if (user_relationships_ui_check_access('approve', NULL)) {
+  if (user_relationships_ui_check_access('approve', NULL)) {
     _user_relationships_ui_set_notifications($account);
   }
 }
@@ -546,7 +546,7 @@ function user_relationships_ui_account_fieldset_remove_if_empty($element) {
   // Go through all child elements, if any of them is visible, do not hide.
   // If no elements exist or none are accessible, hide this element.
   foreach (element_children($element) as $key) {
-    if (!isset($element[$key]['#access'])  || $element[$key]['#access']) {
+    if (!isset($element[$key]['#access'])   || $element[$key]['#access']) {
       return $element;
     }
   }
@@ -605,13 +605,13 @@ function user_relationships_ui_theme() {
   $theme_templates = array(
     'user_relationships' => array(
       'variables' => array('account' => NULL, 'rtid' => NULL),
-      'path'      => drupal_get_path('module', 'user_relationships_ui') .'/templates',
+      'path'      => drupal_get_path('module', 'user_relationships_ui') . '/templates',
       'template'  => 'user_relationships',
     ),
 
     'user_relationships_pending_requests' => array(
       'variables' => array('account' => NULL),
-      'path'      => drupal_get_path('module', 'user_relationships_ui') .'/templates',
+      'path'      => drupal_get_path('module', 'user_relationships_ui') . '/templates',
       'template'  => 'user_relationships_pending_requests',
     ),
   );
@@ -653,7 +653,7 @@ function user_relationships_ui_form_user_relationships_admin_type_edit_alter(&$f
   );
 
   // Load settings.
-  $settings = db_query('SELECT * FROM {user_relationships_ui_settings} WHERE rtid = :rtid', array(':rtid' => (int)$form['rtid']['#value']))->fetchObject();
+  $settings = db_query('SELECT * FROM {user_relationships_ui_settings} WHERE rtid = :rtid', array(':rtid' => (int) $form['rtid']['#value']))->fetchObject();
 
   $form['listings']['ui_settings_hide'] = array(
     '#type' => 'checkbox',
@@ -675,8 +675,8 @@ function user_relationships_ui_user_relationships_type_insert($relationship_type
   db_merge('user_relationships_ui_settings')
     ->key(array('rtid' => $relationship_type->rtid))
     ->fields(array(
-      'hide' => isset($relationship_type->ui_settings_hide) ? (int)$relationship_type->ui_settings_hide : 0,
-      'show_tab' => isset($relationship_type->ui_settings_show_tab) ? (int)$relationship_type->ui_settings_show_tab : 0,
+      'hide' => isset($relationship_type->ui_settings_hide) ? (int) $relationship_type->ui_settings_hide : 0,
+      'show_tab' => isset($relationship_type->ui_settings_show_tab) ? (int) $relationship_type->ui_settings_show_tab : 0,
     ))
     ->execute();
 }
@@ -688,8 +688,8 @@ function user_relationships_ui_user_relationships_type_update($relationship_type
   db_merge('user_relationships_ui_settings')
     ->key(array('rtid' => $relationship_type->rtid))
     ->fields(array(
-      'hide' => isset($relationship_type->ui_settings_hide) ? (int)$relationship_type->ui_settings_hide : 0,
-      'show_tab' => isset($relationship_type->ui_settings_show_tab) ? (int)$relationship_type->ui_settings_show_tab : 0,
+      'hide' => isset($relationship_type->ui_settings_hide) ? (int) $relationship_type->ui_settings_hide : 0,
+      'show_tab' => isset($relationship_type->ui_settings_show_tab) ? (int) $relationship_type->ui_settings_show_tab : 0,
     ))
     ->execute();
 }
diff --git a/user_relationships_ui/user_relationships_ui.pages.inc b/user_relationships_ui/user_relationships_ui.pages.inc
index e2209fd..0df1923 100644
--- a/user_relationships_ui/user_relationships_ui.pages.inc
+++ b/user_relationships_ui/user_relationships_ui.pages.inc
@@ -60,7 +60,7 @@ function user_relationships_page($account = NULL, $rtid = NULL) {
       // Add an empty space to the operations table row.
       $rows[$relationship->rid][] = '&nbsp;';
     }
-   }
+  }
 
   if (!empty($rtid)) {
     $empty = t('You do not have any %rel_plural_name.', user_relationships_type_translations($relationship_type));
@@ -184,7 +184,7 @@ function user_relationships_ui_get_table_row($relationship, $account) {
       $links[] = theme('user_relationships_remove_link', array('uid' => $account->uid, 'rid' => $relationship->rid));
     }
   }
-  else if (user_relationships_ui_check_access($permission, $account, $relationship)) {
+  elseif (user_relationships_ui_check_access($permission, $account, $relationship)) {
     if ($this_user_str == 'requestee') {
       // Sent requests, display cancel link.
       $links[] = theme('user_relationships_pending_request_cancel_link', array('uid' => $account->uid, 'rid' => $relationship->rid));
diff --git a/user_relationships_ui/user_relationships_ui.test b/user_relationships_ui/user_relationships_ui.test
index 7d5f288..e8685c8 100644
--- a/user_relationships_ui/user_relationships_ui.test
+++ b/user_relationships_ui/user_relationships_ui.test
@@ -82,7 +82,7 @@ class UserRelationshipUserSettings extends DrupalWebTestCase {
    * Test the various user settings.
    */
   function testAutoApprovalSettings() {
-     $permissions = array(
+    $permissions = array(
       'can have ' . $this->rtypes['oneway']->name . ' relationships',
       'can request ' . $this->rtypes['oneway']->name . ' relationships',
       'can have ' . $this->rtypes['twoway']->name . ' relationships',
@@ -175,13 +175,13 @@ class UserRelationshipUserSettings extends DrupalWebTestCase {
     $this->assertEqual(count($relationships), 2);
     foreach ($relationships as $relationship) {
       if ($relationship->rtid == $this->rtypes['approval-oneway']->rtid) {
-        $this->assertTrue((bool)$relationship->approved);
+        $this->assertTrue((bool) $relationship->approved);
       }
       elseif ($relationship->rtid == $this->rtypes['approval']->rtid) {
-        $this->assertFalse((bool)$relationship->approved);
+        $this->assertFalse((bool) $relationship->approved);
       }
       else {
-        $this->fail('Unexpected relationship type @type' , array('@type' => $relationship->rtid));
+        $this->fail('Unexpected relationship type @type', array('@type' => $relationship->rtid));
       }
     }
 
