diff --git a/auth/services_oauth/services_oauth.inc b/auth/services_oauth/services_oauth.inc
index ac1020a..c5c819f 100644
--- a/auth/services_oauth/services_oauth.inc
+++ b/auth/services_oauth/services_oauth.inc
@@ -1,6 +1,11 @@
 <?php
 
 /**
+ * @file
+ * Include file for services_oauth module.
+ */
+
+/**
  * Authenticates a call using OAuth to verify the request.
  *
  * @param array $settings
diff --git a/auth/services_oauth/services_oauth.install b/auth/services_oauth/services_oauth.install
index 94d2cbc..fa249cd 100644
--- a/auth/services_oauth/services_oauth.install
+++ b/auth/services_oauth/services_oauth.install
@@ -1,21 +1,21 @@
 <?php
 
 /**
- * Implementation of hook_install().
+ * Implements hook_install().
  */
 function services_oauth_install() {
   drupal_install_schema('services_oauth');
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function services_oauth_uninstall() {
   drupal_uninstall_schema('services_oauth');
 }
 
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function services_oauth_schema() {
   $schema = array();
diff --git a/resources/comment_resource.inc b/resources/comment_resource.inc
index 8ef1c07..586a38d 100644
--- a/resources/comment_resource.inc
+++ b/resources/comment_resource.inc
@@ -367,7 +367,7 @@ function _comment_resource_access($op = 'view', $args = array()) {
  * Passthrough function to _node_resource_access().
  *
  * @see _node_resource_access()
- **/
+ */
 function _comment_resource_node_access($op = 'view', $args = array()) {
   module_load_include('inc', 'services', 'resources/node_resource');
   return _node_resource_access($op, $args);
diff --git a/resources/file_resource.inc b/resources/file_resource.inc
index af9f9e2..7f75e25 100644
--- a/resources/file_resource.inc
+++ b/resources/file_resource.inc
@@ -1,6 +1,11 @@
 <?php
 
 /**
+ * @file
+ * File resource.
+ */
+
+/**
  * THERE SHOULD BE NO UPDATE!!!
  * Drupal doesn't allow updating or replacing a file in the files table.
  * If you need to, create a new file and remove the old file.
@@ -99,10 +104,10 @@ function _file_resource_create($file) {
 
   // Get the directory name for the location of the file:
 
-  if(isset($file->filename) && !isset($file->filepath)) {
-    $file->filepath = file_default_scheme() . '://'. $file->filename;
+  if (isset($file->filename) && !isset($file->filepath)) {
+    $file->filepath = file_default_scheme() . '://' . $file->filename;
   }
-  $dir = file_default_scheme() . '://';  
+  $dir = file_default_scheme() . '://';
   // Build the destination folder tree if it doesn't already exists.
   if (!file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) {
     return services_error("Could not create destination directory for file.", 500);
@@ -111,7 +116,7 @@ function _file_resource_create($file) {
   $file->filemime = file_get_mimetype($file->filename);
 
   // Rename potentially executable files, to help prevent exploits.
-  if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
+  if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $file->filename) && (drupal_substr($file->filename, -4) != '.txt')) {
     $file->filemime = 'text/plain';
     $file->filepath .= '.txt';
     $file->filename .= '.txt';
@@ -120,20 +125,20 @@ function _file_resource_create($file) {
 /*
   //The filepath that ends up in the node must contain the filename
   $file->filepath .= '/'. $file->filename;
-*/
+ */
 
   // Write the file
   if (!$file = file_save_data(base64_decode($file->file), $file->filepath)) {
     return services_error("Could not write file to destination", 500);
   }
-  
+
   //Required to be able to reference this file.
   file_usage_add($file, 'services', 'files', $file->fid);
-  
+
   // hook_file_insert() requires an object
   if (empty($update)) {
     foreach (module_implements('file_insert') as $module) {
-      $function =  $module .'_file_insert';
+      $function =  $module . '_file_insert';
       $function($file);
     }
   }
@@ -157,9 +162,9 @@ function _file_resource_create($file) {
 function _file_resource_retrieve($fid, $include_file_contents = TRUE) {
   if ($file = file_load($fid)) {
     $filepath = $file->uri;
-    if($include_file_contents) {
+    if ($include_file_contents) {
       $file->file = base64_encode(file_get_contents($filepath));
-    } 
+    }
     return $file;
   }
 }
@@ -193,8 +198,8 @@ function _file_resource_access($op = 'view', $args = array()) {
   else {
     $file = file_load($args[0]);
   }
-  if(empty($file)) {
-    return services_error('There is no file with the given ID: '. $args[0], 406);
+  if (empty($file)) {
+    return services_error('There is no file with the given ID: ' . $args[0], 406);
   }
   switch ($op) {
     case 'view':
diff --git a/resources/node_resource.inc b/resources/node_resource.inc
index 180d6d0..bffc30f 100644
--- a/resources/node_resource.inc
+++ b/resources/node_resource.inc
@@ -147,7 +147,7 @@ function _node_resource_definition() {
  *   Node object or FALSE if not found.
  *
  * @see node_load()
- **/
+ */
 function _node_resource_retrieve($nid) {
   global $user;
   $node = node_load($nid);
@@ -172,7 +172,7 @@ function _node_resource_retrieve($nid) {
  *   the fully qualified URI to this resource.
  *
  * @see drupal_execute()
- **/
+ */
 function _node_resource_create($node) {
   $node = (object)$node;
 
@@ -191,10 +191,11 @@ function _node_resource_create($node) {
 
   //Wanted to return a gracefull error instead of a blank nid, this should allow for that.
   $types = node_type_get_types();
-  if(array_key_exists($node->type, $types)) {
+  if (array_key_exists($node->type, $types)) {
     drupal_form_submit($node->type . '_node_form', $form_state, $node);
-  } else {
-    return services_error('Node type "'. $node->type .'" does not exist.', 406);
+  }
+  else {
+    return services_error('Node type "' . $node->type . '" does not exist.', 406);
   }
 
 
@@ -226,7 +227,7 @@ function _node_resource_create($node) {
  *   The node's nid.
  *
  * @see drupal_execute()
- **/
+ */
 function _node_resource_update($nid, $node) {
   $node = (object)$node;
   $node->nid = $nid;
@@ -269,7 +270,7 @@ function _node_resource_update($nid, $node) {
  *   Node ID of the node we're deleting.
  * @return
  *   The node's nid.
- **/
+ */
 function _node_resource_delete($nid) {
   node_delete($nid);
   return 1;
@@ -300,7 +301,7 @@ function _node_resource_delete($nid) {
  *     - Do we need fields at all? Should this just return full nodes?
  *     - Is there an easier syntax we can define which can make the urls
  *       for index requests more straightforward?
- **/
+ */
 function _node_resource_index($page = 0, $fields = '*', $parameters = array()) {
   $node_select = db_select('node', 'n')
     ->addTag('node_access')
@@ -310,11 +311,12 @@ function _node_resource_index($page = 0, $fields = '*', $parameters = array()) {
 
   if ($fields == '*') {
     $node_select->fields('n');
-  } else {
+  }
+  else {
     $fields = explode(',', $fields);
     $node_select->fields('n', $fields);
   }
-  
+
   if (!user_access('administer nodes')) {
     $node_select->condition('status', 1);
   }
@@ -322,7 +324,7 @@ function _node_resource_index($page = 0, $fields = '*', $parameters = array()) {
   $result = $node_select->execute();
 
   $nodes = array();
-  foreach($result as $node) {
+  foreach ($result as $node) {
     if ($uri = services_resource_uri(array('node', $node->nid))) {
       $node->uri = $uri;
     }
@@ -342,31 +344,34 @@ function _node_resource_index($page = 0, $fields = '*', $parameters = array()) {
  * @return bool
  *
  * @see node_access()
- **/
+ */
 function _node_resource_access($op = 'view', $args = array()) {
   // Make sure we have an object or this all fails, some servers can
   // mess up the types.
   if (is_array($args[0])) {
     $args[0] = (object) $args[0];
-  } else if(!is_array($args[0]) && !is_object($args[0])) {  //This is to determine if it is just a string happens on node/%NID
-    $args[0] = (object)array('nid'=>$args[0]);
+  }
+  elseif (!is_array($args[0]) && !is_object($args[0])) {  //This is to determine if it is just a string happens on node/%NID
+    $args[0] = (object)array('nid' => $args[0]);
   }
 
   if ($op != 'create' && !empty($args)) {
     $node = node_load($args[0]->nid);
   }
-  else if ($op == 'create') {
-    if(isset($args[0]->type)) {
+  elseif ($op == 'create') {
+    if (isset($args[0]->type)) {
       $node = $args[0]->type;
       return node_access($op, $node);
-    } else {
+    }
+    else {
       return services_error('Node type is required', 406);
     }
   }
-  if(isset($node->nid) && $node->nid) {
+  if (isset($node->nid) && $node->nid) {
     return node_access($op, $node);
-  } else {
-    return services_error('Node id: '. $args[0]->nid .' could not be found', 404);
+  }
+  else {
+    return services_error('Node id: ' . $args[0]->nid . ' could not be found', 404);
   }
 }
 
@@ -390,7 +395,7 @@ function _node_resource_load_node_files($nid, $include_file_contents = TRUE) {
 
   // Loop through all of the fields on the site
   foreach ($fields as $key => $field) {
-    //if we are a field type of file 
+    //if we are a field type of file
     if ($field['type'] == 'image' || $field['type'] == 'file') {
       // If this field exists on our current node..
       if (isset($node->{$field['field_name']})) {
@@ -398,7 +403,7 @@ function _node_resource_load_node_files($nid, $include_file_contents = TRUE) {
         if (isset($node->{$field['field_name']}[LANGUAGE_NONE])) {
           // Grab the items given and attach them to the array.
           $node_file_field_items = $node->{$field['field_name']}[LANGUAGE_NONE];
-          foreach ($node_file_field_items as $file) { 
+          foreach ($node_file_field_items as $file) {
             $files[] = _file_resource_retrieve($file['fid'], $include_file_contents);
           }
         }
diff --git a/resources/taxonomy_resource.inc b/resources/taxonomy_resource.inc
index 1a25fa6..b277069 100644
--- a/resources/taxonomy_resource.inc
+++ b/resources/taxonomy_resource.inc
@@ -193,7 +193,7 @@ function _taxonomy_resource_definition() {
         'access arguments append' => TRUE,
         'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
       ),
-      'actions' =>array(
+      'actions' => array(
         'getTree' => array(
           'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
           'help'   => t('This method returns a full list of taxonomy terms.'),
@@ -216,7 +216,7 @@ function _taxonomy_resource_definition() {
               'source'       => 'data',
               'default value' => 0,
               'optional'     => TRUE,
-            ), 
+            ),
             array(
               'name'         => 'maxdepth',
               'type'         => 'int',
@@ -240,7 +240,7 @@ function _taxonomy_resource_definition() {
  * @return
  *   A term object.
  *
- * @see taxonomy_get_term().
+ * @see taxonomy_get_term()
  */
 function _taxonomy_term_resource_retrieve($tid) {
   return taxonomy_get_term($tid);
@@ -254,7 +254,7 @@ function _taxonomy_term_resource_retrieve($tid) {
  * @return
  *   Status constant indicating if term was inserted or updated.
  *
- * @see taxonomy_save_term().
+ * @see taxonomy_save_term()
  */
 function _taxonomy_term_resource_create($term) {
   $term = (object)$term;
@@ -271,7 +271,7 @@ function _taxonomy_term_resource_create($term) {
  * @return
  *   Status constant indicating if term was inserted or updated.
  *
- * @see taxonomy_save_term().
+ * @see taxonomy_save_term()
  */
 function _taxonomy_term_resource_update($tid, $term) {
   $term = (object) $term;
@@ -287,7 +287,7 @@ function _taxonomy_term_resource_update($tid, $term) {
  * @return
  *   Status constant indicating deletion.
  *
- * @see taxonomy_del_term().
+ * @see taxonomy_del_term()
  */
 function _taxonomy_term_resource_delete($tid) {
   return taxonomy_term_delete($tid);
@@ -302,7 +302,7 @@ function _taxonomy_term_resource_delete($tid) {
  * @return
  *   A vocabulary object or FALSE.
  *
- * @see taxonomy_vocabulary_load().
+ * @see taxonomy_vocabulary_load()
  */
 function _taxonomy_vocabulary_resource_retrieve($vid) {
   return taxonomy_vocabulary_load($vid);
@@ -335,7 +335,7 @@ function _taxonomy_vocabulary_resource_retrieve($vid) {
  * @return
  *   Status constant indicating if vocabulary was inserted or updated.
  *
- * @see taxonomy_save_vocabulary().
+ * @see taxonomy_save_vocabulary()
  */
 function _taxonomy_vocabulary_resource_create($vocabulary) {
   $vocabulary = (array) $vocabulary;
@@ -352,7 +352,7 @@ function _taxonomy_vocabulary_resource_create($vocabulary) {
  * @return
  *   Status constant indicating if vocabulary was inserted or updated.
  *
- * @see taxonomy_save_vocabulary().
+ * @see taxonomy_save_vocabulary()
  */
 function _taxonomy_vocabulary_resource_update($vid, $vocabulary) {
   $vocabulary = (array) $vocabulary;
@@ -368,7 +368,7 @@ function _taxonomy_vocabulary_resource_update($vid, $vocabulary) {
  * @return
  *   Status constant indicating deletion.
  *
- * @see taxonomy_del_vocabulary().
+ * @see taxonomy_del_vocabulary()
  */
 function _taxonomy_vocabulary_resource_delete($vid) {
   return taxonomy_del_vocabulary($vid);
@@ -379,13 +379,12 @@ function _taxonomy_vocabulary_resource_delete($vid) {
 /**
  * Services interface to taxonomy_get_tree().
  *
- * @see
- *   taxonomy_get_tree()
+ * @see taxonomy_get_tree()
  */
 function taxonomy_service_get_tree($vid, $parent = 0, $max_depth = NULL) {
   $terms = taxonomy_get_tree($vid, $parent, $max_depth);
-  if(empty($terms)) {
-    return services_error('No vocabulary with id: '. $vid .' found.', 404);
+  if (empty($terms)) {
+    return services_error('No vocabulary with id: ' . $vid . ' found.', 404);
   }
   return $terms;
 }
@@ -396,22 +395,21 @@ function taxonomy_service_get_tree($vid, $parent = 0, $max_depth = NULL) {
  * Note that where taxonomy_select_nodes() returns the results
  * of a db_query(), this function returns an array of node objects.
  *
- * @see
- *   taxonomy_select_nodes().
- * @return 
+ * @see taxonomy_select_nodes()
+ * @return
  *   An array of node objects.
  */
 function taxonomy_service_select_nodes($tid = '', $pager = TRUE, $limit = FALSE,  $order = array('t.sticky' => 'DESC', 't.created' => 'DESC')) {
   $result = taxonomy_select_nodes($tid, (bool)$pager, $limit, $order);
-  foreach($result as $nid) {  
+  foreach ($result as $nid) {
     if ($uri = services_resource_uri(array('node', $nid))) {
       $node = node_load($nid);
       $node->uri = $uri;
     }
     $nodes[] = $node;
   }
-  if(empty($nodes)) {
-    return services_error('No nodes were found with tid: '. $tid, 404);
+  if (empty($nodes)) {
+    return services_error('No nodes were found with tid: ' . $tid, 404);
   }
   return $nodes;
 }
diff --git a/resources/user_resource.inc b/resources/user_resource.inc
index 6fc2272..3852e84 100644
--- a/resources/user_resource.inc
+++ b/resources/user_resource.inc
@@ -1,6 +1,5 @@
 <?php
 
-
 function _user_resource_definition() {
   return array(
     'user' => array(
@@ -64,7 +63,7 @@ function _user_resource_definition() {
           ),
         ),
       ),
-     
+
       'delete' => array(
         'help' => 'Deletes a user',
         'callback' => '_user_resource_delete',
@@ -173,11 +172,11 @@ function _user_resource_retrieve($uid) {
 /**
  * Create a new user.
  *
- * This function uses drupal_execute() and as such exepects all input to match 
+ * This function uses drupal_execute() and as such exepects all input to match
  * the submitting form in question.
  *
  * @param $account
- *   A object containing account information. The $account object should 
+ *   A object containing account information. The $account object should
  *   contain, at minimum, the following properties:
  *     - name (user name)
  *     - mail (email address)
@@ -189,8 +188,8 @@ function _user_resource_retrieve($uid) {
  *
  *  Roles can be passed in a roles property which is an associative
  *  array formatted with '<role id>' => '<role id>', not including
- *  the authenticated user role, which is given by default. 
- *  
+ *  the authenticated user role, which is given by default.
+ *
  * @return
  *   The user object of the newly created user.
  */
@@ -216,7 +215,7 @@ function _user_resource_create($account) {
     'pass2' => $account->pass,
   );
   $form_state['values']['op'] = t('Create new account');
-  
+
   $ret = drupal_form_submit('user_register_form', $form_state);
 
   // Error if needed.
@@ -235,7 +234,7 @@ function _user_resource_create($account) {
 /**
  * Update an existing user.
  *
- * This function uses drupal_execute() and as such exepects all input to match 
+ * This function uses drupal_execute() and as such exepects all input to match
  * the submitting form in question.
  *
  * @param $uid
@@ -261,7 +260,7 @@ function _user_resource_update($uid, $account) {
   if (isset($account->roles[2])) {
     $account->roles[2] = 0;
   }
-  
+
   // If a profile category was passed in, use it. Otherwise default
   // to 'account' (for saving core user data.)
   $category = 'account';
@@ -269,14 +268,14 @@ function _user_resource_update($uid, $account) {
     $category = $account->category;
     unset($account->category);
   }
-  
+
   // Drop any passed in values into the $account var. Anything
   // unused by the form just gets ignored.
   foreach ($account as $key => $value) {
     $form_state['values'][$key] = $value;
   }
 
-  if(!isset($account->pass1) && !isset($account->pass2)) {
+  if (!isset($account->pass1) && !isset($account->pass2)) {
       $account->pass1 = $account->pass;
       $account->pass2 = $account->pass;
   }
@@ -391,7 +390,7 @@ function _user_resource_logout() {
  * @param $page
  *   Page number of results to return (in pages of 20).
  * @param $fields
- *   The fields you want returned. 
+ *   The fields you want returned.
  * @param $parameters
  *   An array of fields and values used to build a sql WHERE clause indicating
  *   what items should be deleted.
@@ -399,19 +398,20 @@ function _user_resource_logout() {
  *   An array of user objects.
  *
  * @see _node_resource_index() for more notes
- **/
+ */
 function _user_resource_index($page = 0, $fields = '*', $parameters = array()) {
   $user_select = db_select('users', 'u');
-  if($fields == '*') { 
-    $user_select->fields('u');  
-  } else {
+  if ($fields == '*') {
+    $user_select->fields('u');
+  }
+  else {
     $fields = explode(',', $fields);
     $user_select->fields('u', $fields);
   }
   $user_select->orderBy('created', 'DESC');
   $user_select->range($page * 20, 20);
   $result = $user_select->execute();
-  foreach($result as $user) {  
+  foreach ($result as $user) {
     if ($uri = services_resource_uri(array('user', $user->uid))) {
       $user->uri = $uri;
     }
@@ -425,27 +425,26 @@ function _user_resource_index($page = 0, $fields = '*', $parameters = array()) {
  */
 function _user_resource_access($op = 'view', $args = array()) {
   global $user;
-  switch($op) {
+  switch ($op) {
     case 'view':
-        $account = user_load($args[0]);
-        if(!$account->uid) {
-          return services_error('That user ID does not exist', 406);
-        }
-        return user_view_access($account);   
+      $account = user_load($args[0]);
+      if (!$account->uid) {
+        return services_error('That user ID does not exist', 406);
+      }
+      return user_view_access($account);
     case 'update':
-        $account = user_load($args[1]->uid);
-        if(!$account->uid) {
-          return services_error('That user ID does not exist', 406);
-        }      
+      $account = user_load($args[1]->uid);
+      if (!$account->uid) {
+        return services_error('That user ID does not exist', 406);
+      }
       return ($user->uid == $account->uid || user_access('administer users'));
     case 'create':
       return user_access('administer users');
     case 'delete':
       $account = user_load($args[0]);
-      if(!$account->uid) {
+      if (!$account->uid) {
         return services_error('That user ID does not exist', 406);
       }
       return user_access('administer users');
   }
-
 }
diff --git a/servers/rest_server/formats/RssFormatView.inc b/servers/rest_server/formats/RssFormatView.inc
index 56a01fb..2f25b38 100644
--- a/servers/rest_server/formats/RssFormatView.inc
+++ b/servers/rest_server/formats/RssFormatView.inc
@@ -10,8 +10,8 @@ class RssFormatView extends RESTServerView {
     }
 
     $out = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
-    $out .= '<rss version="2.0" xml:base="' . url('', array('absolute'=>TRUE)) . '"  xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n";
-    $out .= format_rss_channel(variable_get('site_name',''), url($_GET['q'], array('absolute'=>TRUE)), variable_get('site_name',''), $items);
+    $out .= '<rss version="2.0" xml:base="' . url('', array('absolute' => TRUE)) . '"  xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n";
+    $out .= format_rss_channel(variable_get('site_name', ''), url($_GET['q'], array('absolute' => TRUE)), variable_get('site_name', ''), $items);
 
     return $out;
   }
diff --git a/servers/rest_server/formats/XCalFormatView.inc b/servers/rest_server/formats/XCalFormatView.inc
index 0a5e1ee..2272463 100644
--- a/servers/rest_server/formats/XCalFormatView.inc
+++ b/servers/rest_server/formats/XCalFormatView.inc
@@ -68,15 +68,15 @@ class XCalFormatView extends RESTServerView {
     $value = preg_replace('/\n+/', ' ', $value);
     $value = preg_replace('/\s{2,}/', ' ', $value);
 
-    $preamble_len = strlen($preamble);
+    $preamble_len = drupal_strlen($preamble);
 
     $lines = array();
-    while (strlen($value)>(75-$preamble_len)) {
+    while (drupal_strlen($value)>(75-$preamble_len)) {
       $space = (75-$preamble_len);
       $mbcc = $space;
       while ($mbcc) {
         $line = mb_substr($value, 0, $mbcc);
-        $oct = strlen($line);
+        $oct = drupal_strlen($line);
         if ($oct > $space) {
           $mbcc -= $oct-$space;
         }
diff --git a/servers/rest_server/includes/RESTServer.inc b/servers/rest_server/includes/RESTServer.inc
index 9e5c66d..5cfc1b5 100755
--- a/servers/rest_server/includes/RESTServer.inc
+++ b/servers/rest_server/includes/RESTServer.inc
@@ -1,5 +1,10 @@
 <?php
 
+/**
+ * @file
+ * Class for handling REST calls.
+ */
+
 class RESTServer {
   private $endpoint;
 
@@ -174,7 +179,7 @@ class RESTServer {
   private function getControllerArguments($controller, $path, $method, &$sources=array()) {
     // Get argument sources
     $parameters = $_GET;
-    if(isset($parameters['_method'])) {
+    if (isset($parameters['_method'])) {
       unset($parameters['_method']);
     }
 
@@ -204,7 +209,7 @@ class RESTServer {
             }
           }
           else {
-              if(isset($sources[$info['source']][$info['name']])) {
+              if (isset($sources[$info['source']][$info['name']])) {
                 $arguments[$i] = $sources[$info['source']][$info['name']];
               }
           }
@@ -230,9 +235,9 @@ class RESTServer {
           if (isset($info['default value'])) {
             $arguments[$i] = $info['default value'];
           }
-          else if (!isset($info['optional']) || !$info['optional']) {
+          elseif (!isset($info['optional']) || !$info['optional']) {
             throw new ServicesArgumentException(t('Missing required argument !arg', array(
-              '!arg'=>$info['name'])), $info['name'], 406);
+              '!arg' => $info['name'])), $info['name'], 406);
           }
           else {
             $arguments[$i] = NULL;
@@ -263,7 +268,7 @@ class RESTServer {
         $parser = $this->requestParsers($mime, $controller);
         if (!$parser) {
           throw new ServicesException(t('Unsupported request content type !mime', array(
-              '!mime'=>$mime,
+              '!mime' => $mime,
             )), 406);
         }
 
@@ -300,8 +305,8 @@ class RESTServer {
           $pcount = count($pm[0]);
           for ($i=0; $i<$pcount; $i++) {
             $value = $pm[2][$i];
-            if (substr($value, 0, 1) == '"') {
-              $value = stripcslashes(substr($value, 1, mb_strlen($value)-2));
+            if (drupal_substr($value, 0, 1) == '"') {
+              $value = stripcslashes(drupal_substr($value, 1, mb_strlen($value)-2));
             }
             $ret_val['param'][$pm[1][$i]] = $value;
           }
@@ -329,7 +334,7 @@ class RESTServer {
     $filename = file_munge_filename(trim(basename(($disposition['params']['filename']))));
 
     // Rename potentially executable files, to help prevent exploits.
-    if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $filename) && (substr($filename, -4) != '.txt')) {
+    if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $filename) && (drupal_substr($filename, -4) != '.txt')) {
       $type['value'] = 'text/plain';
       $filename .= '.txt';
     }
@@ -463,32 +468,32 @@ class RESTServer {
         'xml' => array(
           'mime types' => array('application/xml', 'text/xml'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'xml'),
+          'view arguments' => array('format' => 'xml'),
         ),
         'json' => array(
           'mime types' => array('application/json'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'json'),
+          'view arguments' => array('format' => 'json'),
         ),
         'jsonp' => array(
           'mime types' => array('text/javascript', 'application/javascript'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'jsonp'),
+          'view arguments' => array('format' => 'jsonp'),
         ),
         'php' => array(
           'mime types' => array('application/vnd.php.serialized'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'php'),
+          'view arguments' => array('format' => 'php'),
         ),
         'yaml' => array(
           'mime types' => array('text/plain', 'application/x-yaml', 'text/yaml'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'yaml'),
+          'view arguments' => array('format' => 'yaml'),
         ),
         'bencode' => array(
           'mime types' => array('application/x-bencode'),
           'view' => 'RESTServerViewBuiltIn',
-          'view arguments' => array('format'=>'bencode'),
+          'view arguments' => array('format' => 'bencode'),
         ),
         'rss' => array(
           'model' => 'ResourceFeedModel',
@@ -528,7 +533,7 @@ class RESTServer {
       return isset($resource['index']) ? $resource['index'] : NULL;
     }
     // Detect the standard crud operations
-    else if (
+    elseif (
         ($pc==1 && ($method=='GET' || $method=='PUT' || $method=='DELETE')) ||
         ($pc==0 && $method='POST')) {
       $action_mapping = array(
@@ -546,18 +551,18 @@ class RESTServer {
       }
     }
     // Detect relationship requests
-    else if ($pc>=2 && $method=='GET') {
+    elseif ($pc >= 2 && $method == 'GET') {
       if (isset($resource['relationships']) && $resource['relationships'][$path[1]]) {
         $relationship = $resource['relationships'][$path[1]];
         return $relationship;
       }
     }
     // Detect action requests
-    else if ($pc==1 && $method=='POST') {
+    elseif ($pc == 1 && $method == 'POST') {
       return $resource['actions'][$path[0]];
     }
     // Detect action requests targeted at specific resources
-    else if ($pc>=2 && $method=='POST') {
+    elseif ($pc >= 2 && $method == 'POST') {
       $action = $resource['targeted actions'][$path[1]];
       return $action;
     }
diff --git a/servers/rest_server/includes/models.inc b/servers/rest_server/includes/models.inc
index 79041f9..fd02450 100644
--- a/servers/rest_server/includes/models.inc
+++ b/servers/rest_server/includes/models.inc
@@ -14,8 +14,8 @@ interface ResourceFeedModel extends Iterator {
   //  * is called. This makes it possible for the model to ensure that required
   //  * data is requested when the model is used.
   //  *
-  //  * @param array &$arguments 
-  //  * @param array $model_arguments 
+  //  * @param array &$arguments
+  //  * @param array $model_arguments
   //  * @return void
   //  */
   // public static function alterArguments(&$arguments, $model_arguments);
@@ -30,7 +30,7 @@ interface ResourceFeedModelItem {
   public function getDescription();
   public function getUrl();
   public function getCreated();
-  
+
   /**
    * Gets a associative array containing extra properties for the item.
    *
@@ -47,7 +47,7 @@ interface ResourceTimeFeedModel extends ResourceFeedModel {
 }
 
 /**
- * Interface that must be implemented by items returned 
+ * Interface that must be implemented by items returned
  * by a ResourceTimeFeedModel.
  */
 interface ResourceTimeFeedModelItem extends ResourceFeedModelItem {
@@ -58,7 +58,7 @@ interface ResourceTimeFeedModelItem extends ResourceFeedModelItem {
    *  The starting time of the item as a timestamp
    */
   public function getStarts();
-  
+
   /**
    * Gets the end time of the item
    *
diff --git a/servers/rest_server/includes/node_resource.models.inc b/servers/rest_server/includes/node_resource.models.inc
index f258718..66908cf 100644
--- a/servers/rest_server/includes/node_resource.models.inc
+++ b/servers/rest_server/includes/node_resource.models.inc
@@ -142,7 +142,11 @@ class NodeResourceFeedModelItem implements ResourceTimeFeedModelItem {
 
     // Allow modules to add additional item fields and/or modify $item
     $extra = node_invoke_nodeapi($item, 'rss item');
-    $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => gmdate('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid .' at '. $base_url, 'attributes' => array('isPermaLink' => 'false'))));
+    $extra = array_merge($extra, array(
+      array('key' => 'pubDate', 'value' => gmdate('r', $item->created)),
+      array('key' => 'dc:creator', 'value' => $item->name),
+      array('key' => 'guid', 'value' => $item->nid . ' at ' . $base_url, 'attributes' => array('isPermaLink' => 'false')))
+    );
     foreach ($extra as $element) {
       if (isset($element['namespace'])) {
         $namespaces = array_merge($namespaces, $element['namespace']);
@@ -157,7 +161,7 @@ class NodeResourceFeedModelItem implements ResourceTimeFeedModelItem {
       case 'teaser':
         $item_text = $item->teaser;
         if (!empty($item->readmore)) {
-          $item_text .= '<p>'. l(t('read more'), 'node/'. $item->nid, array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) .'</p>';
+          $item_text .= '<p>' . l(t('read more'), 'node/' . $item->nid, array('absolute' => TRUE, 'attributes' => array('target' => '_blank'))) . '</p>';
         }
         break;
       case 'title':
@@ -217,4 +221,4 @@ class NodeResourceFeedModelItem implements ResourceTimeFeedModelItem {
   public function getProperties() {
     return get_object_vars($this->node);
   }
-}
\ No newline at end of file
+}
diff --git a/servers/rest_server/includes/rest_server.views.inc b/servers/rest_server/includes/rest_server.views.inc
index 780b4af..4a73b72 100644
--- a/servers/rest_server/includes/rest_server.views.inc
+++ b/servers/rest_server/includes/rest_server.views.inc
@@ -1,7 +1,14 @@
 <?php
+// $Id$
 
 /**
- * Base class for all response format views
+ * @file
+ * Provide formatter class for all standard response formats.
+ *
+ */
+
+/**
+ * Base class for all response format views.
  */
 abstract class RESTServerView {
   protected $model;
@@ -91,7 +98,7 @@ class RESTServerViewBuiltIn extends RESTServerView {
         $parent->setAttribute('is_array', 'true');
       }
     }
-    else if ($data!==NULL) {
+    elseif ($data !== NULL) {
       $parent->appendChild($doc->createTextNode($data));
     }
   }
diff --git a/servers/rest_server/rest_server.api.php b/servers/rest_server/rest_server.api.php
index 9d00cf0..7e0217f 100644
--- a/servers/rest_server/rest_server.api.php
+++ b/servers/rest_server/rest_server.api.php
@@ -17,7 +17,7 @@
 function hook_rest_server_request_parsers_alter() {
   return array(
     'name' => 'REST',
-  );  
+  );
 }
 
 /**
@@ -27,6 +27,6 @@ function hook_rest_server_request_parsers_alter() {
 function hook_rest_server_response_formatters_alter() {
   return array(
     'name' => 'REST',
-  );  
+  );
 }
 
diff --git a/servers/rest_server/rest_server.inc b/servers/rest_server/rest_server.inc
index 2173e8d..462a8ac 100644
--- a/servers/rest_server/rest_server.inc
+++ b/servers/rest_server/rest_server.inc
@@ -1,5 +1,10 @@
 <?php
 
+/**
+ * @file
+ * Autoload classes.
+ */
+
 function _rest_server_autoload_info() {
   return array(
     'RESTServer' => array(
diff --git a/servers/rest_server/rest_server.module b/servers/rest_server/rest_server.module
index c9cc9fb..801f2e4 100755
--- a/servers/rest_server/rest_server.module
+++ b/servers/rest_server/rest_server.module
@@ -10,11 +10,11 @@ function rest_server_server_info() {
 
 function rest_server_server() {
   $endpoint_path = services_get_server_info('endpoint_path', 'services/rest');
-  $canonical_path = trim(substr($_GET['q'], drupal_strlen($endpoint_path)), '/');
+  $canonical_path = trim(drupal_substr($_GET['q'], drupal_strlen($endpoint_path)), '/');
   $canonical_path = explode('/', $_GET['q']);
   $endpoint_path_count = count(explode('/', $endpoint_path));
-  for($x=0; $x<$endpoint_path_count;$x++) {
-   array_shift($canonical_path);
+  for ($x = 0; $x < $endpoint_path_count; $x++) {
+    array_shift($canonical_path);
   }
   $canonical_path = implode('/', $canonical_path);
   if (empty($canonical_path)) {
@@ -27,7 +27,7 @@ function rest_server_server() {
   }
   catch (Exception $e) {
     $code = $e->getCode();
-    switch($code) {
+    switch ($code) {
       case 401:
         drupal_add_http_header('HTTP/1.0 401 Unauthorized', $e->getMessage());
       break;
@@ -50,7 +50,7 @@ function rest_server_server() {
 }
 
 /**
- * Implementation of hook_services_resources_alter().
+ * Implements hook_services_resources_alter().
  */
 function rest_server_services_resources_alter($resources, $endpoint) {
   // Set the default models for the retrieve and index controllers in the node
diff --git a/services.admin.inc b/services.admin.inc
index 3a9661c..9c4b1ed 100644
--- a/services.admin.inc
+++ b/services.admin.inc
@@ -39,7 +39,7 @@ function services_list_endpoint($js = NULL) {
     else {
       $debug[] = array(
         'title' => t('Turn On'),
-        'style' => array('color'=> 'green'),
+        'style' => array('color' => 'green'),
         'href'  => 'admin/config/services/services/' . $endpoint->name . '/enabledebug',
         'query' => drupal_get_destination(),
       );
@@ -90,7 +90,8 @@ function services_list_endpoint($js = NULL) {
       else {
         $row_class = 'services-endpoint-enabled';
       }
-    } else {
+    }
+    else {
       $row_class = 'services-endpoint-disabled';
     }
     $auth_names = array();
@@ -124,20 +125,20 @@ function services_list_endpoint($js = NULL) {
         ),
         'debug' => array(
           'data'  => array(
-             '#theme' => 'links',
-             '#links' => $debug,
-           ),
-	 	      'class' => array('services-endpoint-debug'),
+            '#theme' => 'links',
+            '#links' => $debug,
+          ),
+          'class' => array('services-endpoint-debug'),
         ),
         'operations' => array(
           'data'  => array(
-             '#theme' => 'links',
-             '#links' => $operations,
-           ),
+            '#theme' => 'links',
+            '#links' => $operations,
+          ),
           'class' => array('services-endpoint-operations'),
         ),
       ),
-      'class' =>$row_class,
+      'class' => $row_class,
     );
   }
   drupal_add_css(drupal_get_path('module', 'services') . '/css/services.admin.css');
@@ -492,7 +493,7 @@ function services_edit_form_endpoint_authentication($form, &$form_state) {
         'Drupal session based security will be used.'),
     );
   }
-  else if (empty($endpoint->authentication)) {
+  elseif (empty($endpoint->authentication)) {
     $form['message'] = array(
       '#type'          => 'item',
       '#title'         => t('No enabled authentication modules'),
diff --git a/services.authentication.api.php b/services.authentication.api.php
index 4261384..6676a6b 100644
--- a/services.authentication.api.php
+++ b/services.authentication.api.php
@@ -13,9 +13,9 @@
  /**
   * Supplies information about a given authentication method to Services.
   *
-  * @return 
+  * @return
   *   An associative array with information about the authentication method
-  *   and its callbacks. The possible keys are as follows (all keys are 
+  *   and its callbacks. The possible keys are as follows (all keys are
   *   optional unless noted).
   *
   *   - title (required): The display name for this authentication method.
@@ -24,15 +24,15 @@
   *   - authenticate_call (required): The name of a function to be called
   *     to perform the actual authentication. <details of params/return>
   *   - security_settings: A callback function which returns an associative
-  *     array of Form API elements for a settings form. 
+  *     array of Form API elements for a settings form.
   *   - _services_oauth_security_settings_validate: The name of a standard form
   *     validation callback for the form defined in 'security_settings'.
   *   - _services_oauth_security_settings_submit: The name of a standard form
   *     submit callback for the form defined in 'security_settings'.
-  *   - alter_methods: The name of a callback function which will alter a 
+  *   - alter_methods: The name of a callback function which will alter a
   *     services method signature in order to add required arguments.
-  *   - file: An include file which contains the authentication callbacks. 
+  *   - file: An include file which contains the authentication callbacks.
   */
 function hook_services_authentication_info() {
-  
+
 }
diff --git a/services.install b/services.install
index 3e0ae9c..9798802 100644
--- a/services.install
+++ b/services.install
@@ -5,7 +5,7 @@
  */
 
 /**
- * Implementation of hook_schema().
+ * Implements hook_schema().
  */
 function services_schema() {
   $schema = array();
@@ -88,7 +88,7 @@ function services_schema() {
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function services_uninstall() {
   $ret = array();
@@ -106,6 +106,7 @@ function services_uninstall() {
   variable_del('services_debug');
   variable_del('services_auth_module');
 }
+
 /**
  * Update 7301 adds debugging to each endopint to facilitate easier development
  */
@@ -119,4 +120,4 @@ function services_update_7301() {
  */
 function services_update_7302() {
   db_drop_field('services_endpoint', 'status');
-}
\ No newline at end of file
+}
diff --git a/services.module b/services.module
index 4b2597c..3423345 100644
--- a/services.module
+++ b/services.module
@@ -6,18 +6,18 @@
  */
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function services_help($path, $arg) {
   $output = NULL;
 
   switch ($path) {
     case 'admin/help#services':
-      $output = '<p>'. t('Visit the <a href="@handbook_url">Services Handbook</a> for help and information.', array('@handbook_url' => 'http://drupal.org/node/109782')) .'</p>';
+      $output = '<p>' . t('Visit the <a href="@handbook_url">Services Handbook</a> for help and information.', array('@handbook_url' => 'http://drupal.org/node/109782')) . '</p>';
       break;
     case 'admin/config/services/services':
-      $output = '<p>'. t('Services are collections of methods available to remote applications. They are defined in modules, and may be accessed in a number of ways through server modules. Visit the <a href="@handbook_url">Services Handbook</a> for help and information.', array('@handbook_url' => 'http://drupal.org/node/109782')) .'</p>';
-      $output .= '<p>'. t('All enabled services and methods are shown. Click on any method to view information or test.') .'</p>';
+      $output = '<p>' . t('Services are collections of methods available to remote applications. They are defined in modules, and may be accessed in a number of ways through server modules. Visit the <a href="@handbook_url">Services Handbook</a> for help and information.', array('@handbook_url' => 'http://drupal.org/node/109782')) . '</p>';
+      $output .= '<p>' . t('All enabled services and methods are shown. Click on any method to view information or test.') . '</p>';
       $output .= '<div id="services-help-legend"><div class="services-endpoint-enabled">Enabled</div><div class="services-endpoint-debug">Enabled With Debug</div><div class="services-endpoint-disabled">Disabled</div></div>';
       break;
   }
@@ -26,7 +26,7 @@ function services_help($path, $arg) {
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_perm().
  */
 function services_permission() {
   return array(
@@ -60,7 +60,7 @@ function services_permission() {
 }
 
 /**
- * Implementation of hook_hook_info().
+ * Implements hook_hook_info().
  */
 function services_hook_info() {
   $hooks['services_resources'] = array(
@@ -70,7 +70,7 @@ function services_hook_info() {
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function services_menu() {
   $base = array(
@@ -132,12 +132,12 @@ function services_menu() {
      'page callback'  => 'services_disable_debug_mode',
      'page arguments' => array(4),
      'type'           => MENU_CALLBACK,
-   ) + $base;
-   $items['admin/config/services/services/%services_endpoint/enabledebug'] = array(
+  ) + $base;
+  $items['admin/config/services/services/%services_endpoint/enabledebug'] = array(
      'page callback'  => 'services_enable_debug_mode',
      'page arguments' => array(4),
      'type'           => MENU_CALLBACK,
-   ) + $base;
+  ) + $base;
   $items['admin/config/services/services/%services_endpoint/disable'] = array(
     'page callback'  => 'services_disable_endpoint',
     'page arguments' => array(4),
@@ -152,7 +152,7 @@ function services_menu() {
     'page callback' => '_services_ahah_security_options',
     'type'          => MENU_CALLBACK,
   ) + $base;
-  
+
   $endpoints = services_endpoint_load_all();
   foreach ($endpoints as $endpoint) {
     if (empty($endpoint->disabled)) {
@@ -183,7 +183,7 @@ function services_access_menu() {
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function services_theme() {
   return array(
@@ -236,7 +236,7 @@ function services_endpoint_callback($endpoint_name) {
       'debug'         => $endpoint->debug,
       'drupal_path'   => getcwd(),
     ));
-    if($endpoint->debug) {
+    if ($endpoint->debug) {
       watchdog('services', 'Calling server: %server', array('%server' => $server . '_server'), WATCHDOG_DEBUG);
       watchdog('services', 'Server info main object: <pre>@info</pre>', array('@info' => print_r(services_server_info_object(), TRUE)), WATCHDOG_DEBUG);
     }
@@ -278,8 +278,8 @@ function services_endpoint_load($name) {
     return $result[$name];
   }
   else {
-    $result =  db_query("SELECT * FROM {services_endpoint} WHERE name = :name", array(':name'=>$name));
- 	  $matches = array();
+    $result = db_query("SELECT * FROM {services_endpoint} WHERE name = :name", array(':name' => $name));
+    $matches = array();
     foreach ($result as $endpoint) {
       return $endpoint;
     }
@@ -296,9 +296,9 @@ function services_endpoint_load($name) {
 function services_endpoint_load_all() {
   ctools_include('export');
   $matches = ctools_export_load_object('services_endpoint');
-  if(!$matches) {
+  if (!$matches) {
     $result =  db_query("SELECT * FROM {services_endpoint}");
- 	  $matches = array();
+    $matches = array();
     foreach ($result as $endpoint) {
       $matches[] = $endpoint;
     }
@@ -381,7 +381,7 @@ function services_get_resources($endpoint_name = '') {
 }
 
 /**
- * Implementation of hook_services_resources().
+ * Implements hook_services_resources().
  */
 function services_services_resources() {
   module_load_include('resource_build.inc', 'services');
diff --git a/services.runtime.inc b/services.runtime.inc
index 6ec78ba..e0c6dc6 100644
--- a/services.runtime.inc
+++ b/services.runtime.inc
@@ -94,7 +94,7 @@ class ServicesArgumentException extends ServicesException {
  */
 function services_controller_execute($controller, $args = array(), $options = array()) {
   $server_info =  services_server_info_object();
-  if($server_info->debug) {
+  if ($server_info->debug) {
     watchdog('services', 'Controller: <pre>@controller</pre>', array('@controller' => print_r($controller, TRUE)), WATCHDOG_DEBUG);
     watchdog('services', 'Passed arguments: <pre>@arguments</pre>', array('@arguments' => print_r($args, TRUE)), WATCHDOG_DEBUG);
   }
@@ -152,7 +152,7 @@ function services_controller_execute($controller, $args = array(), $options = ar
   }
 
   // Execute the controller callback
-  if($server_info->debug) {
+  if ($server_info->debug) {
     watchdog('services', 'Called arguments: <pre>@arguments</pre>', array('@arguments' => print_r($args, TRUE)), WATCHDOG_DEBUG);
   }
   $result = call_user_func_array($controller['callback'], $args);
diff --git a/services.servers.api.php b/services.servers.api.php
index f9b879e..dff762b 100644
--- a/services.servers.api.php
+++ b/services.servers.api.php
@@ -21,7 +21,7 @@
 function hook_server_info() {
   return array(
     'name' => 'REST',
-  );  
+  );
 }
 
 /**
@@ -32,5 +32,5 @@ function hook_server_info() {
  * servers.
  */
 function hook_server() {
-  
+
 }
\ No newline at end of file
diff --git a/services.services.api.php b/services.services.api.php
index b040d40..02d6dda 100644
--- a/services.services.api.php
+++ b/services.services.api.php
@@ -16,7 +16,7 @@
   * ways Services can be seen as an abstraction layer on top of hook_menu().
   *
   * @return
-  *   An associative array which defines available resources. 
+  *   An associative array which defines available resources.
   *
   *   The associative array which defines services has eight possible top
   *   level keys:
@@ -33,30 +33,30 @@
   *   The CRUD functions are pretty self-explanatory. Index is an extra CRUD-
   *   type function that allows you to create pageable lists.
   *
-  *   Actions are performed directly on the resource type, not a individual 
+  *   Actions are performed directly on the resource type, not a individual
   *   resource. The following example is hypothetical (but plausible). Say
-  *   that you want to expose a API for the apachesolr module. One of the 
-  *   things that could be exposed is the functionality to reindex the whole 
+  *   that you want to expose a API for the apachesolr module. One of the
+  *   things that could be exposed is the functionality to reindex the whole
   *   site at apachesolr/reindex.
   *
-  *   Targeted actions acts on a individual resource. A good, but again - 
+  *   Targeted actions acts on a individual resource. A good, but again -
   *   hypothetical, example would be the publishing and unpublishing of nodes
   *   at node/123/publish.
   *
-  *   Relationship requests are convenience methods (sugar) to get something 
+  *   Relationship requests are convenience methods (sugar) to get something
   *   thats related to a individual resource. A real example would be the
-  *   ability to get the files for a node at node/123/files.  
+  *   ability to get the files for a node at node/123/files.
   *
   *   The first five (the CRUD functions + index) define the indvidual service
   *   callbacks for each function. However 'actions', 'targeted actions',
-  *   and 'relationships' can contain multiple callbacks. 
+  *   and 'relationships' can contain multiple callbacks.
   *
-  *   For those familiar with Services 2.x, these callbacks are created 
+  *   For those familiar with Services 2.x, these callbacks are created
   *   similarly, but the keys have changed around a bit. The following keys
   *   are used to describe a callback.
   *
   *   - help: Text describing what this callback does.
-  *   - callback: The name of a function to call when this resource is 
+  *   - callback: The name of a function to call when this resource is
   *     requested.
   *   - access callback: The name of a function to call to check whether
   *     the requesting user has permission to access this resource. If not
@@ -75,10 +75,10 @@
   *     - description: Text describing this argument's usage.
   *     - optional: A boolean indicating whether or not this argument is optional.
   *     - source: Where this argument should be retrieved from. This can be
-  *       'data' (indicating the POST data), 'param' (indicating the query 
-  *       string) or 'path' (indicating the url path). In the case of path, 
+  *       'data' (indicating the POST data), 'param' (indicating the query
+  *       string) or 'path' (indicating the url path). In the case of path,
   *       an additional parameter must be passed indicating the index to be used.
-  *     - default value: this is a value that will be passed to the method for 
+  *     - default value: this is a value that will be passed to the method for
   *       this particular argument if no argument value is passed
   *
   *   A detailed example of creating a new resource can be found at
diff --git a/tests/functional/NoAuthEndpointTestRunner.test b/tests/functional/NoAuthEndpointTestRunner.test
index 07ac9b0..113a95e 100644
--- a/tests/functional/NoAuthEndpointTestRunner.test
+++ b/tests/functional/NoAuthEndpointTestRunner.test
@@ -11,20 +11,21 @@
 /**
  * Sets conditions for a no-authentication set of endpoint test runs.
  */
- class NoAuthEndpointTestRunner extends ServicesEndpointTests {
+class NoAuthEndpointTestRunner extends ServicesEndpointTests {
 
   // Class variables
-  protected $privilegedUser = NULL ;
+  protected $privilegedUser = NULL;
 
-   /**
-    * Implementation of getInfo().
-    */
-   public static function getInfo() {
-     return array(
-       'name'        => t('Services Endpoint tests, no auth'),
-       'description' =>
-         t('Test the endpoint functionality when no authentication is turned on'),
-       'group'       => t('Services'),
-     ) ;
-   }
- }
\ No newline at end of file
+  /**
+   * Implementation of getInfo().
+   */
+  public static function getInfo() {
+    return array(
+      'name' => t('Services Endpoint tests, no auth'),
+      'description' =>
+      t('Test the endpoint functionality when no authentication is turned on'),
+      'group' => t('Services'),
+    );
+  }
+
+}
\ No newline at end of file
diff --git a/tests/functional/ServicesEndpointTests.test b/tests/functional/ServicesEndpointTests.test
index 691471b..613b067 100644
--- a/tests/functional/ServicesEndpointTests.test
+++ b/tests/functional/ServicesEndpointTests.test
@@ -11,105 +11,106 @@
  * Run test cases for the endpoint with no authentication turned on.
  *
  */
- class ServicesEndpointTests extends ServicesWebTestCase {
+class ServicesEndpointTests extends ServicesWebTestCase {
+  /**
+   * Test adding an endpoint succeeds.
+   */
+  public function testEndpointForm() {
+    $edit = $this->populateEndpointFAPI();
+// Create and log in our privileged user.
+    $this->privilegedUser = $this->drupalCreateUser(array(
+      'administer services',
+    ));
+    $this->drupalLogin($this->privilegedUser);
+    $this->drupalPost('admin/config/services/services/add', $edit, t('Save and proceed'));
+    $this->drupalGet($edit['path']);
+  }
 
-/**
-    * Test adding an endpoint succeeds.
-    */
-   public function testEndpointForm() {
-     $edit = $this->populateEndpointFAPI();
-     // Create and log in our privileged user.
-     $this->privilegedUser = $this->drupalCreateUser(array(
-         'administer services',
-     ));
-     $this->drupalLogin($this->privilegedUser);
-     $this->drupalPost('admin/config/services/services/add', $edit, t('Save and proceed'));
-     $this->drupalGet($edit['path']);
-   }
-   /**
-    * Test adding an endpoint succeeds.
-    */
-   public function testSuccessfulAddEndpoint() {
-     $edit = $this->populateEndpointFAPI() ;
+  /**
+   * Test adding an endpoint succeeds.
+   */
+  public function testSuccessfulAddEndpoint() {
+    $edit = $this->populateEndpointFAPI();
     $this->privilegedUser = $this->drupalCreateUser(array(
-       'administer services',
-       'administer content types',
+      'administer services',
+      'administer content types',
     ));
     $this->drupalLogin($this->privilegedUser);
-     $this->drupalPost('admin/config/services/services/add', $edit, t('Save and proceed')) ;
-     $this->assertResponse('200', t('expected 200'));
-     $this->drupalGet('admin/config/services/services/list') ;
-     $this->assertResponse('200',t('expected 200'));
+    $this->drupalPost('admin/config/services/services/add', $edit, t('Save and proceed'));
+    $this->assertResponse('200', t('expected 200'));
+    $this->drupalGet('admin/config/services/services/list');
+    $this->assertResponse('200', t('expected 200'));
 
-     $this->assertText($edit['title'], t('Endpoint path appears')) ;
-     $this->assertText('rest_server', t('Server is rest server')) ;
-     $this->assertText('In database', t('Storage is in database')) ;
-   }
+    $this->assertText($edit['title'], t('Endpoint path appears'));
+    $this->assertText('rest_server', t('Server is rest server'));
+    $this->assertText('In database', t('Storage is in database'));
+  }
 
-   /**
-    * Test missing path to endpoint causes an error.
-    */
-   public function testMissingPath() {
-     $edit = $this->populateEndpointFAPI() ;
-     unset($edit['path']) ;
+  /**
+   * Test missing path to endpoint causes an error.
+   */
+  public function testMissingPath() {
+    $edit = $this->populateEndpointFAPI();
+    unset($edit['path']);
     $this->privilegedUser = $this->drupalCreateUser(array(
-       'administer services',
-       'administer content types',
+      'administer services',
+      'administer content types',
     ));
     $this->drupalLogin($this->privilegedUser);
-     $this->drupalPost('admin/config/services/services/add', $edit, t('Save and proceed')) ;
-     $this->assertResponse('200', 'expected 200');
+    $this->drupalPost('admin/config/services/services/add', $edit, t('Save and proceed'));
+    $this->assertResponse('200', 'expected 200');
 
-     $this->assertText('Path to endpoint field is required.',
-       t('Endpoint path missing error message.')) ;
-     $this->assertFieldByName('title', $edit['title'],
-       t('Title field remains.')) ;
-     $this->assertFieldByName('server', 'rest_server',
-       t('Server is rest server')) ;
-   }
+    $this->assertText('Path to endpoint field is required.',
+      t('Endpoint path missing error message.'));
+    $this->assertFieldByName('title', $edit['title'],
+      t('Title field remains.'));
+    $this->assertFieldByName('server', 'rest_server',
+      t('Server is rest server'));
+  }
 
-   /**
-    * Test missing title for endpoint causes an error.
-    */
-   public function testMissingTitle() {
-     $edit = $this->populateEndpointFAPI() ;
-     unset($edit['title']) ;
+  /**
+   * Test missing title for endpoint causes an error.
+   */
+  public function testMissingTitle() {
+    $edit = $this->populateEndpointFAPI();
+    unset($edit['title']);
     $this->privilegedUser = $this->drupalCreateUser(array(
-       'administer services',
-       'administer content types',
+      'administer services',
+      'administer content types',
     ));
     $this->drupalLogin($this->privilegedUser);
-     $this->drupalPost('admin/config/services/services/add', $edit, t('Save and proceed')) ;
-     $this->assertResponse('200', 'expected 200');
+    $this->drupalPost('admin/config/services/services/add', $edit, t('Save and proceed'));
+    $this->assertResponse('200', 'expected 200');
 
-     $this->assertText('Endpoint title field is required.',
-       t('Endpoint title missing error message.')) ;
-     $this->assertFieldByName('name', $edit['name'],
-       t('Name field remains.')) ;
-     $this->assertFieldByName('server', 'rest_server',
-       t('Server is rest server')) ;
-   }
+    $this->assertText('Endpoint title field is required.',
+      t('Endpoint title missing error message.'));
+    $this->assertFieldByName('name', $edit['name'],
+      t('Name field remains.'));
+    $this->assertFieldByName('server', 'rest_server',
+      t('Server is rest server'));
+  }
 
-   /**
-    * Test missing server for endpoint causes an error.
-    */
-   public function testMissingServer() {
-     $edit = $this->populateEndpointFAPI() ;
-     unset($edit['server']) ;
+  /**
+   * Test missing server for endpoint causes an error.
+   */
+  public function testMissingServer() {
+    $edit = $this->populateEndpointFAPI();
+    unset($edit['server']);
     $this->privilegedUser = $this->drupalCreateUser(array(
-       'administer services',
-       'administer content types',
+      'administer services',
+      'administer content types',
     ));
     $this->drupalLogin($this->privilegedUser);
-     $this->drupalPost('admin/config/services/services/add', $edit,
-       t('Save and proceed')) ;
-     $this->assertResponse('200', 'expected 200');
+    $this->drupalPost('admin/config/services/services/add', $edit,
+      t('Save and proceed'));
+    $this->assertResponse('200', 'expected 200');
+
+    $this->assertText('Server field is required.',
+      t('Server missing error message.'));
+    $this->assertFieldByName('name', $edit['name'],
+      t('Name field remains.'));
+    $this->assertFieldByName('title', $edit['title'],
+      t('Title field remains.'));
+  }
 
-     $this->assertText('Server field is required.',
-       t('Server missing error message.')) ;
-     $this->assertFieldByName('name', $edit['name'],
-       t('Name field remains.')) ;
-     $this->assertFieldByName('title', $edit['title'],
-       t('Title field remains.')) ;
-   }
 }
\ No newline at end of file
diff --git a/tests/functional/ServicesResourceNodeTests.test b/tests/functional/ServicesResourceNodeTests.test
index 3f3d6cc..8f5e740 100644
--- a/tests/functional/ServicesResourceNodeTests.test
+++ b/tests/functional/ServicesResourceNodeTests.test
@@ -33,11 +33,11 @@ class ServicesResourceNodetests extends ServicesWebTestCase {
    * Implementation of getInfo().
    */
   public static function getInfo() {
-   return array(
-     'name'        => t('Resource Node'),
-     'description' => t('test the resource Node methods and actions.'),
-     'group'       => t('Services'),
-   );
+    return array(
+      'name' => t('Resource Node'),
+      'description' => t('Test the resource Node methods and actions.'),
+      'group' => t('Services'),
+    );
   }
 
   /**
diff --git a/tests/services.test b/tests/services.test
index 78a705d..d62ff75 100644
--- a/tests/services.test
+++ b/tests/services.test
@@ -4,18 +4,18 @@ class ServicesWebTestCase extends DrupalWebTestCase {
 
   public function setUp() {
     $args = func_get_args();
-  
+
     $modules = array();
     if (isset($args[0]) && is_array($args[0])) {
       $modules = $args[0];
     }
-  
+
     // Add the required module dependencies.
     array_unshift($modules, 'ctools', 'services', 'rest_server');
-  
+
     parent::setUp($modules);
   }
-  
+
 
   protected function servicesGet($url, $data = NULL, $headers = array()) {
     $options = array('query' => $data);
@@ -91,7 +91,7 @@ class ServicesWebTestCase extends DrupalWebTestCase {
       CURLOPT_HEADER => TRUE,
       CURLOPT_HTTPHEADER => $headers,
       CURLOPT_INFILE => $putData,
-      CURLOPT_INFILESIZE => strlen($serialize_args)
+      CURLOPT_INFILESIZE => drupal_strlen($serialize_args)
     ));
     fclose($putData);
 
@@ -142,11 +142,11 @@ class ServicesWebTestCase extends DrupalWebTestCase {
    */
   function parseHeader($content) {
     $info = curl_getinfo($this->curlHandle);
-    $header = substr($content, 0, $info['header_size']);
+    $header = drupal_substr($content, 0, $info['header_size']);
     $header = str_replace("HTTP/1.1 100 Continue\r\n\r\n", '', $header);
     $status = strtok($header, "\r\n");
     $code = $info['http_code'];
-    $body = unserialize(substr($content, $info['header_size'], strlen($content) - $info['header_size']));
+    $body = unserialize(drupal_substr($content, $info['header_size'], drupal_strlen($content) - $info['header_size']));
     return array($info, $header, $status, $code, $body);
   }
 
@@ -426,7 +426,7 @@ class ServicesWebTestCase extends DrupalWebTestCase {
       '!method' => $method,
       '@url' => isset($original_url) ? $original_url : $url,
       '@status' => $status,
-      '!length' => format_size(strlen($this->drupalGetContent()))
+      '!length' => format_size(drupal_strlen($this->drupalGetContent()))
     );
     $message = t('!method @url returned @status (!length).', $message_vars);
     $this->assertTrue($this->drupalGetContent() !== FALSE, $message, t('Browser'));
diff --git a/tests/unit/TestServicesModule.test b/tests/unit/TestServicesModule.test
index 55f7673..bdf059e 100644
--- a/tests/unit/TestServicesModule.test
+++ b/tests/unit/TestServicesModule.test
@@ -9,15 +9,14 @@
 /**
  * Run test cases for the functions in the 'services.module' file.
  */
- class ServicesModuleTests extends DrupalWebTestCase {
+class ServicesModuleTests extends DrupalWebTestCase {
+  // Class variables.
+  protected $privilegedUser = NULL ;
 
-   // Class variables.
-   protected $privilegedUser = NULL ;
-
-   /**
-    * Implementation of getInfo.
-    */
-   public static function getInfo() {
+  /**
+   * Implementation of getInfo.
+   */
+  public static function getInfo() {
     return array(
       'name' => 'Unit tests for services.module file.',
       'description' => 'These are the unit tests for the services.module file functions.',
@@ -33,7 +32,7 @@
       'ctools',
       'services',
       'rest_server'
-      );
+    );
 
     // Create and logi in our privileged user.
     $this->privilegedUser = $this->drupalCreateUser(array(
@@ -103,10 +102,8 @@
 
     $message = t("There should be a '$perm' permission") ;
     $this->assertTrue($result, $message);
-/*
-    $this->fail(print_r($arrayToSearch, 1));
-    $this->assertNotIdentical($result, FALSE, $message) ;
-*/
+//    $this->fail(print_r($arrayToSearch, 1));
+//    $this->assertNotIdentical($result, FALSE, $message) ;
   } // function
 
   /**
@@ -186,30 +183,30 @@
        'title'  => $this->randomName(20),
        'path'   => $this->randomName(10),
        'server' => 'rest_server',
-     );
-
-     $this->drupalPost('admin/config/services/services/add', $endpointSettings,
-       t('Save and proceed'));
-     $this->assertResponse('200', t('Failed to create endpoint.'));
-
-     // Check path.
-     $this->drupalGet($endpointSettings['path']);
-     $this->assertResponse('200', t('Failed to access endpoint menu path.'));
-
-     // Check edit.
-     $this->drupalGet('admin/config/services/services/' . $endpointSettings['name']
-       . '/edit');
-     $this->assertResponse('200', t('Failed to access endpoint edit path.')) ;
-
-     // Check export.
-     $this->drupalGet('admin/config/services/services/' . $endpointSettings['name']
-       . '/export');
-     $this->assertResponse('200', t('Failed to access endpoint export path.')) ;
-
-     // Check delete.
-     $this->drupalGet('admin/config/services/services/' . $endpointSettings['name']
-       . '/delete');
-     $this->assertResponse('200', t('Failed to access endpoint delete path.')) ;
+    );
+
+    $this->drupalPost('admin/config/services/services/add', $endpointSettings,
+      t('Save and proceed'));
+    $this->assertResponse('200', t('Failed to create endpoint.'));
+
+    // Check path.
+    $this->drupalGet($endpointSettings['path']);
+    $this->assertResponse('200', t('Failed to access endpoint menu path.'));
+
+    // Check edit.
+    $this->drupalGet('admin/config/services/services/' . $endpointSettings['name']
+     . '/edit');
+    $this->assertResponse('200', t('Failed to access endpoint edit path.')) ;
+
+    // Check export.
+    $this->drupalGet('admin/config/services/services/' . $endpointSettings['name']
+     . '/export');
+    $this->assertResponse('200', t('Failed to access endpoint export path.')) ;
+
+    // Check delete.
+    $this->drupalGet('admin/config/services/services/' . $endpointSettings['name']
+     . '/delete');
+    $this->assertResponse('200', t('Failed to access endpoint delete path.')) ;
   }
 
   /*
@@ -227,24 +224,20 @@
    * Void. Feedback is given through the test harness via assertions.
    */
   protected function helpMenuItem($menuItem, $items) {
-    $message = $menuItem . t(' should exist') ;
-    $this->assertTrue(isset($items[$menuItem]), $message) ;
+    $message = t('%menuItem should exist', array('%menuItem' => $menuItem));
+    $this->assertTrue(isset($items[$menuItem]), $message);
 
-    $message = $menuItem . t(' value should be an array') ;
-    $this->assertTrue(gettype($items[$menuItem]) == 'array', $message) ;
+    $message = t('%menuItem value should be an array', array('%menuItem' => $menuItem));
+    $this->assertTrue(gettype($items[$menuItem]) == 'array', $message);
 
-    $message = $menuItem
-      . t(' should have \'access arguments\' set to \'administer services\'') ;
-    $this->assertEqual($items[$menuItem]['access arguments']
-      [0], 'administer services', $message) ;
+    $message = t("%menuItem should have 'access arguments' set to 'administer services'", array('%menuItem' => $menuItem));
+    $this->assertEqual($items[$menuItem]['access arguments'][0], 'administer services', $message);
 
-    $message = $menuItem
-      . t(' should have \'file\' to \'services.admin.inc\'') ;
-    $this->assertEqual($items[$menuItem]['file'], 'services.admin.inc',
-      $message) ;
+    $message = t("%menuItem should have 'file' to 'services.admin.inc'", array('%menuItem' => $menuItem));
+    $this->assertEqual($items[$menuItem]['file'], 'services.admin.inc', $message);
 
-    $message = $menuItem . t(' should have a \'page callback\'') ;
-    $this->assertTrue(isset($items[$menuItem]['page callback']), $message) ;
+    $message = t("%menuItem should have a 'page callback'", array('%menuItem' => $menuItem));
+    $this->assertTrue(isset($items[$menuItem]['page callback']), $message);
   } // function
 
   /**
@@ -288,23 +281,18 @@
     $message = t('services_endpoints_new() should return an object.');
     $this->assertEqual($results_type, 'object', $message);
 
-    $message = t('New Service object should have property ') ;
-    $this->assertTrue(property_exists($results, 'eid'   ),
-      $message . t('eid.'));
-    $this->assertTrue(property_exists($results, 'name'  ),
-      $message . t('name.'));
-    $this->assertTrue(property_exists($results, 'title' ),
-      $message . t('title.'));
-    $this->assertTrue(property_exists($results, 'server'),
-      $message . t('server.'));
-    $this->assertTrue(property_exists($results, 'path'  ),
-      $message . t('path.'));
+    $string = 'New Service object should have property ';
+    $this->assertTrue(property_exists($results, 'eid'), t($string . 'eid.'));
+    $this->assertTrue(property_exists($results, 'name'), t($string . 'name.'));
+    $this->assertTrue(property_exists($results, 'title'), t($string . 'title.'));
+    $this->assertTrue(property_exists($results, 'server'), t($string . 'server.'));
+    $this->assertTrue(property_exists($results, 'path'  ), t($string . 'path.'));
   }
 
   /**
    * Test services_controller_get().
    */
-  public function testServicesControllerGet() {
-
-  }
- } // class
\ No newline at end of file
+//  public function testServicesControllerGet() {
+//
+//  }
+} // class
\ No newline at end of file
