diff --git a/services/db.inc b/services/db.inc
index 99c3139..e3e7269 100644
--- a/services/db.inc
+++ b/services/db.inc
@@ -4,14 +4,24 @@
  * @file
  * DB Storage class files for Storage API.
  */
+
+/**
+ * Provides a DB storage container.
+ */
 class StorageDB extends StorageContainer implements StorageContainerInterface {
 
+  /**
+   * {@inheritdoc}
+   */
   private function setActiveDB() {
 
     db_set_active($this->settings['db']);
     return new StorageDBActive();
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsDefault() {
     return array(
       'db' => 'default',
@@ -19,6 +29,9 @@ class StorageDB extends StorageContainer implements StorageContainerInterface {
     );
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsForm($already_exists) {
     global $databases;
 
@@ -47,6 +60,9 @@ class StorageDB extends StorageContainer implements StorageContainerInterface {
     return $items;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsValidate($already_exists) {
     $active = $this->setActiveDB();
 
@@ -64,13 +80,24 @@ class StorageDB extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceCreate() {
     $active = $this->setActiveDB();
 
     $spec = array(
       'fields' => array(
-        'file_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE),
-        'contents' => array('type' => 'blob', 'size' => 'big', 'not null' => TRUE),
+        'file_id' => array(
+          'type' => 'int',
+          'unsigned' => TRUE,
+          'not null' => TRUE,
+        ),
+        'contents' => array(
+          'type' => 'blob',
+          'size' => 'big',
+          'not null' => TRUE,
+        ),
       ),
       'primary key' => array('file_id'),
     );
@@ -78,6 +105,9 @@ class StorageDB extends StorageContainer implements StorageContainerInterface {
     db_create_table($this->settings['table'], $spec);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInfo() {
 
     $info = array(
@@ -88,12 +118,18 @@ class StorageDB extends StorageContainer implements StorageContainerInterface {
     return $info;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceDestroy() {
     $active = $this->setActiveDB();
 
     db_drop_table($this->settings['table']);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceCreate(Storage $storage, $uri) {
     $active = $this->setActiveDB();
 
@@ -107,25 +143,34 @@ class StorageDB extends StorageContainer implements StorageContainerInterface {
     return $storage->file_id;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceListReferences() {
     $active = $this->setActiveDB();
 
     return db_select($this->settings['table'])
-        ->fields($this->settings['table'], array('file_id'))
-        ->execute()
-        ->fetchCol();
+      ->fields($this->settings['table'], array('file_id'))
+      ->execute()
+      ->fetchCol();
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceExists($reference) {
     $active = $this->setActiveDB();
 
     return db_select($this->settings['table'])
-        ->condition('file_id', $reference)
-        ->countQuery()
-        ->execute()
-        ->fetchField();
+      ->condition('file_id', $reference)
+      ->countQuery()
+      ->execute()
+      ->fetchField();
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceGetContents($reference) {
     $active = $this->setActiveDB();
 
@@ -142,6 +187,9 @@ class StorageDB extends StorageContainer implements StorageContainerInterface {
     return $contents;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceDestroy($reference) {
     $active = $this->setActiveDB();
 
@@ -150,6 +198,9 @@ class StorageDB extends StorageContainer implements StorageContainerInterface {
       ->execute();
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceOutput($reference) {
 
     echo $this->serviceInstanceGetContents($reference);
@@ -157,8 +208,14 @@ class StorageDB extends StorageContainer implements StorageContainerInterface {
 
 }
 
+/**
+ * Provides an Active DB storage.
+ */
 class StorageDBActive {
 
+  /**
+   * Destroys the StorageDBActive instance.
+   */
   public function __destruct() {
     db_set_active();
   }
diff --git a/services/fs.inc b/services/fs.inc
index 3c09ca2..9357fde 100644
--- a/services/fs.inc
+++ b/services/fs.inc
@@ -4,8 +4,15 @@
  * @file
  * FS Storage class files for Storage API.
  */
+
+/**
+ * Provides a file system storage container.
+ */
 class StorageFS extends StorageContainer implements StorageContainerInterface {
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsDefault() {
     return array(
       'path' => '',
@@ -13,6 +20,9 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
     );
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsForm($already_exists) {
     if (!$this->settings['path']) {
       $this->settings['path'] = storage_new_local_storage_path();
@@ -33,8 +43,6 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
     }
 
     if (!$this->access_control) {
-      $description = 'The URL of the directory path specified above (typically exactly the same).' . ' ';
-      $description .= 'Can be absolute or relative.';
 
       if (!$this->settings['base_url']) {
         $this->settings['base_url'] = $this->settings['path'];
@@ -43,7 +51,7 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
       $items['base_url'] = array(
         '#type' => 'textfield',
         '#title' => t('Base URL'),
-        '#description' => t($description),
+        '#description' => t("The URL of the directory path specified above (typically exactly the same). Can be absolute or relative."),
         '#required' => TRUE,
         '#validated' => TRUE,
         '#default_value' => $this->settings['base_url'],
@@ -53,8 +61,10 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
     return $items;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsValidate($already_exists) {
-
     if (!$this->settings['path']) {
       form_set_error('settings][path', t('Directory path field is required.'));
       return;
@@ -73,6 +83,9 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceCreate() {
     if (!file_prepare_directory($this->settings['path'], FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
       form_set_error('settings][path', t('The directory %directory could not be created. Please check permissions.', array('%directory' => $this->settings['path'])));
@@ -81,20 +94,44 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInfo() {
     $info['Free space'] = storage_format_byte_count(@disk_free_space($this->settings['path']));
     $info['Directory'] = realpath($this->settings['path']);
     return $info;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceDestroy() {
     return @rmdir($this->settings['path']);
   }
 
+  /**
+   * Gets the instance path.
+   *
+   * @param string $reference
+   *   The path reference.
+   *
+   * @return string
+   *   The instance path.
+   */
   private function instancePath($reference) {
     return $this->settings['path'] . '/' . $reference;
   }
 
+  /**
+   * Creates the directory path if it does not exist.
+   *
+   * @param string $reference
+   *   The path reference.
+   *
+   * @return string
+   *   The directory path.
+   */
   private function ensureDirectoryPathExists($reference) {
     $dirs = explode('/', $reference);
     $basename = array_pop($dirs);
@@ -105,7 +142,7 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
       $test_path = $path . $dir;
 
       while (!is_dir($this->instancePath($test_path)) &&
-      !@mkdir($this->instancePath($test_path))) {
+        !@mkdir($this->instancePath($test_path))) {
         $count++;
         $test_path = $path . $dir . '_' . $count;
       }
@@ -116,8 +153,10 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
     return $path . $basename;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceCreate(Storage $storage, $uri) {
-
     $reference = $this->uniqueFilename($this->ensureDirectoryPathExists($storage->filename));
     $path = $this->instancePath($reference);
 
@@ -131,6 +170,17 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * Recursively gets a list of files in the directory and any sub-directories.
+   *
+   * @param string $dir
+   *   The directory to scan.
+   *
+   * @return array
+   *   An array of file names.
+   *
+   * @throws \StorageException
+   */
   private function scanDirectory($dir) {
     $files = array();
     $handle = opendir($dir);
@@ -163,21 +213,31 @@ class StorageFS extends StorageContainer implements StorageContainerInterface {
     return $files;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceListReferences() {
 
     return $this->scanDirectory($this->settings['path']);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceExists($reference) {
-
     return @stat($this->instancePath($reference)) !== FALSE;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceGetUri($reference) {
-
     return $this->instancePath($reference);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceDestroy($reference) {
 
     @drupal_unlink($this->instancePath($reference));
diff --git a/services/ftp.inc b/services/ftp.inc
index e1df9d2..cdeebd0 100644
--- a/services/ftp.inc
+++ b/services/ftp.inc
@@ -4,10 +4,22 @@
  * @file
  * FTP Storage class files for Storage API.
  */
+
+/**
+ * Provides an FTP storage container.
+ */
 class StorageFTP extends StorageContainer implements StorageContainerInterface {
 
   private $ftpStream;
 
+  /**
+   * Login to the FTP server.
+   *
+   * @param bool $change_directory
+   *   TRUE to change directory.
+   *
+   * @throws \StorageException
+   */
   private function login($change_directory = TRUE) {
 
     if (isset($this->ftpStream)) {
@@ -38,6 +50,9 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * Destroys the StorageFTP instance.
+   */
   public function __destruct() {
 
     if ($this->ftpStream != NULL) {
@@ -45,6 +60,14 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * Create the specified directory.
+   *
+   * @param string $directory
+   *   The directory to create.
+   *
+   * @throws \StorageException
+   */
   private function createDirectory($directory) {
 
     if (!ftp_mkdir($this->ftpStream, $directory)) {
@@ -52,6 +75,14 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * Recursively create directories in the path.
+   *
+   * @param string $path
+   *   The directory path.
+   *
+   * @throws \StorageException
+   */
   private function createDirectoryRecursive($path) {
     $original_dir = ftp_pwd($this->ftpStream);
 
@@ -68,6 +99,14 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     $this->changeDirectory($original_dir);
   }
 
+  /**
+   * Remove the specified directory.
+   *
+   * @param string $directory
+   *   The directory to remove.
+   *
+   * @throws \StorageException
+   */
   private function removeDirectory($directory) {
 
     if (!@ftp_rmdir($this->ftpStream, $directory)) {
@@ -75,6 +114,14 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * Change to the specified directory.
+   *
+   * @param string $directory
+   *   The directory to change to.
+   *
+   * @throws \StorageException
+   */
   private function changeDirectory($directory) {
 
     if (!@ftp_chdir($this->ftpStream, $directory)) {
@@ -82,6 +129,16 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * Set the file mode for the file.
+   *
+   * @param string $filename
+   *   The file name.
+   * @param string $mode
+   *   The file mode.
+   *
+   * @throws \StorageException
+   */
   private function setMode($filename, $mode) {
 
     if (!ftp_chmod($this->ftpStream, octdec(str_pad($mode, 4, '0', STR_PAD_LEFT)), $filename)) {
@@ -89,6 +146,9 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsDefault() {
     return array(
       'host' => '',
@@ -100,12 +160,15 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     );
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsForm($already_exists) {
 
     $items['host'] = array(
       '#type' => 'textfield',
       '#title' => t('Host'),
-      '#description' => t('The FTP server address. This parameter shouldn\'t have any trailing slashes and shouldn\'t be prefixed with ftp:// .'),
+      '#description' => t("The FTP server address. This parameter shouldn't have any trailing slashes and shouldn't be prefixed with ftp:// ."),
       '#required' => TRUE,
       '#validated' => TRUE,
       '#default_value' => $this->settings['host'],
@@ -125,7 +188,7 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     $items['username'] = array(
       '#type' => 'textfield',
       '#title' => t('Username'),
-      '#description' => t(''),
+      '#description' => '',
       '#required' => TRUE,
       '#validated' => TRUE,
       '#default_value' => $this->settings['username'],
@@ -148,7 +211,7 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     $items['mode'] = array(
       '#type' => 'textfield',
       '#title' => t('File mode'),
-      '#description' => t('Octal format, e.g. 644.<br />For serving, ensure the files are readable by the web server.<br />If omitted, the FTP server\'s default permissions will be used.'),
+      '#description' => t("Octal format, e.g. 644.<br />For serving, ensure the files are readable by the web server.<br />If omitted, the FTP server's default permissions will be used."),
       '#maxlength' => 4,
       '#size' => 5,
       '#default_value' => $this->settings['mode'],
@@ -168,8 +231,10 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     return $items;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsValidate($already_exists) {
-
     if (!$this->settings['host']) {
       form_set_error('settings][host', t('Host field is required.'));
     }
@@ -221,15 +286,24 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceCreate() {
     $this->login(FALSE);
     $this->createDirectoryRecursive($this->settings['directory']);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function servicePostCreate() {
     $this->changeDirectory($this->settings['directory']);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInfo() {
     $info = array(
       t('Host') => $this->settings['host'],
@@ -249,6 +323,9 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     return $info;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceDestroy() {
     $this->login(FALSE);
 
@@ -256,10 +333,19 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
       $this->removeDirectory($this->settings['directory']);
     }
     catch (StorageException $e) {
-      
+
     }
   }
 
+  /**
+   * Change to the directory that contains the file.
+   *
+   * @param string $filename
+   *   The file name.
+   *
+   * @return string
+   *   The directory path.
+   */
   private function enterFileDirectory($filename) {
     $components = explode('/', $filename);
     $basename = array_pop($components);
@@ -287,8 +373,7 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
         }
 
         break;
-      }
-      while (TRUE);
+      } while (TRUE);
 
       $directory = $potential;
     }
@@ -298,6 +383,9 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     return implode('/', $components);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceCreate(Storage $storage, $uri) {
     $this->login();
     $original_dir = ftp_pwd($this->ftpStream);
@@ -320,6 +408,15 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     return $reference;
   }
 
+  /**
+   * Lists all files in the directory.
+   *
+   * @param string $dir
+   *   The directory.
+   *
+   * @return array
+   *   An array of file names.
+   */
   private function listItems($dir) {
     $files = array();
 
@@ -353,18 +450,27 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     return $files;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceListReferences() {
     $this->login();
 
     return $this->listItems('.');
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceExists($reference) {
     $this->login();
 
     return ftp_size($this->ftpStream, $reference) != -1;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceDestroy($reference) {
     $this->login();
 
@@ -386,6 +492,9 @@ class StorageFTP extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceGetUri($reference) {
     $this->login();
 
diff --git a/services/rackspace.inc b/services/rackspace.inc
index 53cb4a8..4329310 100644
--- a/services/rackspace.inc
+++ b/services/rackspace.inc
@@ -4,10 +4,22 @@
  * @file
  * Rackspace Storage class files for Storage API.
  */
+
+/**
+ * Provides a Rackspace Cloudfiles storage container.
+ */
 class StorageRackspace extends StorageContainer implements StorageContainerInterface {
 
   private $conn;
 
+  /**
+   * Logs an exception.
+   *
+   * @param \Exception $e
+   *   The exception to log.
+   * @param bool $dsm
+   *   (optional) TRUE to use drupal_set_message().
+   */
   private function log_exception(Exception $e, $dsm = TRUE) {
     watchdog('storage_rackspace', 'php-cloudfiles exception: @msg', array('@msg' => $e->getMessage()), WATCHDOG_ERROR);
 
@@ -16,6 +28,11 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     }
   }
 
+  /**
+   * Initialize the Rackspace storage container.
+   *
+   * @throws \StorageException
+   */
   private function init() {
     if (module_exists('libraries') && function_exists('libraries_load')) {
       $library = libraries_load('php-cloudfiles');
@@ -57,6 +74,14 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     $this->conn->ssl_use_cabundle();
   }
 
+  /**
+   * Creates a CloudFiles container.
+   *
+   * @return \StorageContainerInterface
+   *   The CloudFiles container.
+   *
+   * @throws \StorageException
+   */
   private function cf_container() {
     $cf_containers = &drupal_static(__FUNCTION__, array());
 
@@ -79,6 +104,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     return $cf_container;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsDefault() {
     return array(
       'locality' => 'us',
@@ -88,6 +116,12 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     );
   }
 
+  /**
+   * Returns the list of CloudFiles locations.
+   *
+   * @return array
+   *   An associative array of locations.
+   */
   private function localities() {
     return array(
       'us' => t('United States'),
@@ -95,9 +129,16 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     );
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsForm($already_exists) {
     $items['credentials_info'] = array(
-      '#markup' => t('Get your credentials !link.', array('!link' => l(t('here'), 'http://www.rackspace.com/cloud/cloud_hosting_products/files/', array('attributes' => array('target' => '_blank')))))
+      '#markup' => t('Get your credentials !link.',
+        array(
+          '!link' => l(t('here'), 'http://www.rackspace.com/cloud/cloud_hosting_products/files/',
+            array('attributes' => array('target' => '_blank'))),
+        )),
     );
 
     $items['locality'] = array(
@@ -134,8 +175,8 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     if (!$this->access_control) {
       $replacements = array(
         '!link' => l(t('CNAME'), 'http://en.wikipedia.org/wiki/CNAME_record', array(
-          'attributes' => array('target' => '_blank')
-        ))
+          'attributes' => array('target' => '_blank'),
+        )),
       );
       $description = t('Points to the Rackspace domain name for the container (leave blank to obtain automatically), or a !link alias of it.', $replacements);
 
@@ -150,6 +191,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     return $items;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsValidate($already_exists) {
     if (!$this->settings['username']) {
       form_set_error('settings][username', t('Username field is required.'));
@@ -195,6 +239,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceCreate() {
     $this->init();
 
@@ -202,10 +249,12 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
       $cf_container = $this->conn->create_container($this->settings['cf_container']);
 
       if ($this->access_control) {
-        $cf_container->make_private();    // strangely, this has to be done explicity, or it might be public
+        // Strangely, this has to be done explicity, or it might be public.
+        $cf_container->make_private();
       }
       else {
-        $cf_container->make_public(60 * 60 * 24 * 3);    // 3 days is the maximum ttl that can be set in the api
+        // 3 days is the maximum ttl that can be set in the api.
+        $cf_container->make_public(60 * 60 * 24 * 3);
       }
     }
     catch (Exception $e) {
@@ -214,6 +263,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function servicePostCreate() {
     // Get the base URL from Rackspace if necessary.
     if (!$this->access_control && !$this->settings['base_url']) {
@@ -222,8 +274,12 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
       $this->settings['base_url'] = $this->cf_container()->cdn_uri;
       return TRUE;
     }
+    return FALSE;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceUpdate() {
     // Get the base URL from Rackspace if necessary.
     if (!$this->access_control && !$this->settings['base_url']) {
@@ -231,6 +287,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInfo() {
     $localities = $this->localities();
 
@@ -243,6 +302,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     return $info;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceDestroy() {
     $this->init();
 
@@ -264,6 +326,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceListReferences() {
     $cf_container = $this->cf_container();
 
@@ -276,6 +341,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceCreate(Storage $storage, $uri) {
     $reference = $this->uniqueFilename($storage->filename);
 
@@ -302,7 +370,6 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
         $cf_container->delete_object($reference);
       }
       catch (Exception $e) {
-        
       }
 
       throw new StorageException();
@@ -311,6 +378,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     return $reference;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceExists($reference) {
     $cf_container = $this->cf_container();
 
@@ -324,6 +394,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     return TRUE;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceDestroy($reference) {
     $cf_container = $this->cf_container();
 
@@ -336,6 +409,9 @@ class StorageRackspace extends StorageContainer implements StorageContainerInter
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceGetUri($reference) {
     $cf_container = $this->cf_container();
     $temp_uri = new StorageTempURI();
diff --git a/services/s3.inc b/services/s3.inc
index b3c09bb..7af9b0c 100644
--- a/services/s3.inc
+++ b/services/s3.inc
@@ -4,9 +4,24 @@
  * @file
  * Amazon S3 Storage class files for Storage API.
  */
+
+/**
+ * Provides an Amazon S3 storage container.
+ */
 class StorageS3 extends StorageContainer implements StorageContainerInterface {
 
-  private function signature($source, $cf = false) {
+  /**
+   * Generates an S3 request signature.
+   *
+   * @param string $source
+   *   The source.
+   * @param bool $cf
+   *   Use CloudFront.
+   *
+   * @return bool|string
+   *   The signature, or FALSE if the signature could not be generated.
+   */
+  private function signature($source, $cf = FALSE) {
     if (!$cf) {
       // @todo Determine why the secret key will not be pulled from settings
       return base64_encode(hash_hmac('sha1', utf8_encode($source), $this->settings['secret_access_key'], TRUE));
@@ -15,20 +30,27 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
       $key = openssl_get_privatekey($this->settings['cf_key_contents']);
       if (!$key) {
         watchdog('storage_s3', 'Amazon S3 error: Unable to get key from Cloudfront key file contents ID @id', array('@id' => $this->settings['cf_key_id']), WATCHDOG_ERROR);
-        if (user_access('administer storage'))
+        if (user_access('administer storage')) {
           drupal_set_message(t('Amazon S3 error: Unable to get key from Cloudfront key file contents ID @id', array('@id' => $this->settings['cf_key_id'])), 'error');
+        }
         return FALSE;
       }
       if (!openssl_sign($source, $signed_source, $key)) {
         watchdog('storage_s3', 'Amazon S3 error: Unable to create signature using Cloudfront key file contents ID @id', array('@id' => $this->settings['cf_key_id']), WATCHDOG_ERROR);
-        if (user_access('administer storage'))
+        if (user_access('administer storage')) {
           drupal_set_message(t('Amazon S3 error: Unable to create signature using Cloudfront key file contents ID @id', array('@id' => $this->settings['cf_key_id'])), 'error');
+        }
         return FALSE;
       }
       openssl_free_key($key);
-      return str_replace(array('+', '=', '/'), array('-', '_', '~'), base64_encode($signed_source));
+      return str_replace(array('+', '=', '/'), array(
+        '-',
+        '_',
+        '~',
+      ), base64_encode($signed_source));
     }
   }
+
   /**
    * Parse a header into an array.
    */
@@ -36,7 +58,8 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     $headers = array();
 
     $source = explode("\r\n", trim($source));
-    array_shift($source);  // Get rid of the HTTP result line.
+    // Get rid of the HTTP result line.
+    array_shift($source);
 
     foreach ($source as $header) {
       list($header, $value) = explode(':', $header . ':', 3);
@@ -45,16 +68,25 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
 
     return $headers;
   }
+
   /**
    * Function to perform a request against S3.
-   * 
+   *
    * @param string $op
+   *   The operation. Valid values are GET, PUT, HEAD, DELETE
    * @param string $bucket
+   *   (optional) The bucket name.
    * @param string $object_name
+   *   (optional) The object name.
    * @param Storage $storage
+   *   (optional) The storage source.
    * @param string $uri
+   *   (optional) The uri.
    * @param array $query
+   *   (optional) An array of query string parameters.
+   *
    * @return array
+   *   The request result.
    */
   private function request($op, $bucket = NULL, $object_name = NULL, Storage $storage = NULL, $uri = NULL, array $query = array()) {
     $result = array();
@@ -185,8 +217,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
 
             watchdog('storage_s3', 'Amazon S3 error: @msg', array('@msg' => $msg), WATCHDOG_ERROR);
 
-            if (user_access('administer storage'))
+            if (user_access('administer storage')) {
               drupal_set_message(t('Amazon S3 error: @msg', array('@msg' => $msg)), 'error');
+            }
           }
         }
       }
@@ -195,6 +228,19 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     return $result;
   }
 
+  /**
+   * Gets RTMP data for the S3 object.
+   *
+   * @param string $s3_object
+   *   The S3 object.
+   *
+   * @return array
+   *   An array of RTMP data. Keys include:
+   *   - streamer
+   *   - file
+   *
+   * @throws \StorageException
+   */
   private function rtmp($s3_object) {
 
     if ($this->settings['cloudfront_streaming'] && $this->settings['cloudfront_streaming_status'] == 'Deployed') {
@@ -207,6 +253,19 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     throw new StorageException();
   }
 
+  /**
+   * Makes a CloudFront request.
+   *
+   * @param string $op
+   *   The operation to perform. Valid values are: POST, PUT, GET, DELETE
+   * @param bool $streaming
+   *   (optional) TRUE to use streaming.
+   * @param string|null $xml
+   *   (optional) The XML payload for POST or PUT operations.
+   *
+   * @return array
+   *   The request results.
+   */
   private function requestCloudFront($op, $streaming = FALSE, $xml = NULL) {
     $result = array();
     $date = date(DATE_RFC1123, time());
@@ -297,8 +356,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
 
           watchdog('storage_s3', 'Amazon CloudFront error: @msg', array('@msg' => $msg), WATCHDOG_ERROR);
 
-          if (user_access('administer storage'))
+          if (user_access('administer storage')) {
             drupal_set_message(t('Amazon CloudFront error: @msg', array('@msg' => $msg)), 'error');
+          }
         }
       }
     }
@@ -306,6 +366,12 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     return $result;
   }
 
+  /**
+   * Gets the Amazon regions.
+   *
+   * @return array
+   *   An associative array of Amazon regions.
+   */
   private function locations() {
 
     return array(
@@ -321,6 +387,12 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     );
   }
 
+  /**
+   * Generates a caller reference ID.
+   *
+   * @return string
+   *   The unique caller reference ID.
+   */
   private function callerReference() {
     static $id;
 
@@ -328,6 +400,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     return REQUEST_TIME . '-' . ++$id;
   }
 
+  /**
+   * Creates a CloudFront distribution.
+   */
   private function distributionCreate() {
 
     $xml = '<?xml version="1.0" encoding="UTF-8"?>';
@@ -354,6 +429,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     watchdog('storage_s3', $message, NULL, WATCHDOG_NOTICE, l(t('view'), $this->path()));
   }
 
+  /**
+   * Creates a streaming CloudFront distribution.
+   */
   private function distributionCreateStreaming() {
 
     $xml = '<?xml version="1.0" encoding="UTF-8"?>';
@@ -380,6 +458,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     watchdog('storage_s3', $message, NULL, WATCHDOG_NOTICE, l(t('view'), $this->path()));
   }
 
+  /**
+   * Deploys a CloudFront distribution.
+   */
   private function distributionDeploy() {
     $result = $this->requestCloudFront('GET');
 
@@ -408,6 +489,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     watchdog('storage_s3', $message, NULL, WATCHDOG_NOTICE, l(t('view'), $this->path()));
   }
 
+  /**
+   * Deploys a streaming CloudFront distribution.
+   */
   private function distributionDeployStreaming() {
     $result = $this->requestCloudFront('GET', TRUE);
 
@@ -426,7 +510,6 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
       if ($this->settings['cloudfront_streaming_status'] != 'Deployed') {
         return;
       }
-
       $message = 'Deployed CloudFront streaming distribution for storage container <i>' . check_plain($this->name()) . '</i>.';
     }
 
@@ -436,6 +519,11 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     watchdog('storage_s3', $message, NULL, WATCHDOG_NOTICE, l(t('view'), $this->path()));
   }
 
+  /**
+   * Deletes a CloudFront distribution.
+   *
+   * @throws \StorageException
+   */
   private function distributionDelete() {
     $result = $this->requestCloudFront('GET');
 
@@ -480,6 +568,11 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     throw new StorageException();
   }
 
+  /**
+   * Deletes a streaming CloudFront distribution.
+   *
+   * @throws \StorageException
+   */
   private function distributionDeleteStreaming() {
     $result = $this->requestCloudFront('GET', TRUE);
 
@@ -524,6 +617,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     throw new StorageException();
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsDefault() {
     return array(
       'access_key_id' => '',
@@ -537,6 +633,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     );
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsForm($already_exists) {
     $items['bucket_warning'] = array(
       '#prefix' => '<div style="font-weight: bold;">',
@@ -576,8 +675,8 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
 
     $replacements = array(
       '!link' => l(t('Customizing Amazon S3 URLs with CNAMEs'), 'http://docs.amazonwebservices.com/AmazonS3/latest/dev/VirtualHosting.html', array(
-        'attributes' => array('target' => '_blank')
-      ))
+        'attributes' => array('target' => '_blank'),
+      )),
     );
     $description = t('See !link. Currently ignored for CloudFront.', $replacements);
 
@@ -642,27 +741,30 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
       );
 
       $items['cf_signed_notice_2'] = array(
-        '#markup' => t('<p>If you have not created a Cloudfront Key Pair.  You must stop this process and go complete those steps first. Note: creating and setting up Cloudfront distribution changes can take a long time.') . ' ' . l('Link to AWS Security Credentials page', 'https://console.aws.amazon.com/iam/home?#security_credential', array('external' => TRUE)) . '</p>',
+        '#markup' => t('<p>If you have not created a Cloudfront Key Pair.  You must stop this process and go complete those steps first. Note: creating and setting up Cloudfront distribution changes can take a long time.') . ' ' . l(t('Link to AWS Security Credentials page'), 'https://console.aws.amazon.com/iam/home?#security_credential', array('external' => TRUE)) . '</p>',
       );
 
       $items['cf_key_id'] = array(
         '#type' => 'textfield',
         '#title' => t('Cloudfront key pair ID'),
         '#default_value' => (!empty($this->settings['cf_key_id'])) ? $this->settings['cf_key_id'] : '',
-        '#description' => t('This is the Key Pair ID provided by Amazon for your Cloudfront key that you have created.')
+        '#description' => t('This is the Key Pair ID provided by Amazon for your Cloudfront key that you have created.'),
       );
 
       $items['cf_key_contents'] = array(
         '#type' => 'textarea',
         '#title' => t('Cloudfront Private key contents'),
         '#default_value' => (!empty($this->settings['cf_key_contents'])) ? $this->settings['cf_key_contents'] : '',
-        '#description' => t('This is the contents of the Private Key downloaded from Amazon.  Paste in the ENTIRE contents of the downloaded PEM file. The file should start with "-----BEGIN RSA PRIVATE KEY-----" and end with "-----END RSA PRIVATE KEY-----".')
+        '#description' => t('This is the contents of the Private Key downloaded from Amazon.  Paste in the ENTIRE contents of the downloaded PEM file. The file should start with "-----BEGIN RSA PRIVATE KEY-----" and end with "-----END RSA PRIVATE KEY-----".'),
       );
     }
 
     return $items;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceSettingsValidate($already_exists) {
 
     if (!$this->settings['access_key_id']) {
@@ -702,6 +804,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceCreate() {
     if ($this->result['http_code'] != 200) {
       $result = $this->request('PUT', $this->settings['bucket']);
@@ -716,6 +821,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function servicePostCreate() {
     if ($this->settings['cloudfront']) {
       $this->distributionCreate();
@@ -730,6 +838,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     return isset($update);
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceUpdate() {
     if ($this->settings['cloudfront'] && !isset($this->settings['cloudfront_id'])) {
       $this->distributionCreate();
@@ -740,6 +851,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInfo() {
     $locations = $this->locations();
 
@@ -756,10 +870,12 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     else {
       if ($this->settings['cloudfront']) {
 
-        if ($this->settings['cloudfront_status'] == 'Deployed')
+        if ($this->settings['cloudfront_status'] == 'Deployed') {
           $status = t('Yes');
-        else
+        }
+        else {
           $status = t('Setting up. This can take a few minutes.');
+        }
       }
       else {
         $status = t('No');
@@ -768,16 +884,19 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
       $info[t('Serving with CloudFront')] = $status;
 
       if (isset($this->settings['cloudfront_status']) &&
-        $this->settings['cloudfront_status'] == 'Deployed') {
+        $this->settings['cloudfront_status'] == 'Deployed'
+      ) {
         $info[t('CloudFront domain name')] = $this->settings['cloudfront_domain'];
       }
 
       if ($this->settings['cloudfront_streaming']) {
 
-        if ($this->settings['cloudfront_streaming_status'] == 'Deployed')
+        if ($this->settings['cloudfront_streaming_status'] == 'Deployed') {
           $status = t('Yes');
-        else
+        }
+        else {
           $status = t('Setting up. This can take a few minutes.');
+        }
       }
       else {
         $status = t('No');
@@ -786,7 +905,8 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
       $info[t('Streaming with CloudFront')] = $status;
 
       if (isset($this->settings['cloudfront_streaming_status']) &&
-        $this->settings['cloudfront_streaming_status'] == 'Deployed') {
+        $this->settings['cloudfront_streaming_status'] == 'Deployed'
+      ) {
         $info[t('CloudFront streaming domain name')] = $this->settings['cloudfront_streaming_domain'];
       }
     }
@@ -794,6 +914,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     return $info;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceDestroy() {
     $failed = FALSE;
 
@@ -821,6 +944,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceMaintenance() {
     if ($this->settings['cloudfront'] && $this->settings['cloudfront_status'] != 'Deployed') {
       $this->distributionDeploy();
@@ -831,6 +957,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceCreate(Storage $storage, $uri) {
     $reference = $this->uniqueFilename($storage->filename);
 
@@ -844,6 +973,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceCopy(Storage $storage, StorageContainerInterface $source_container) {
     $reference = $this->uniqueFilename($storage->filename);
 
@@ -853,17 +985,30 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
 
     if ($result['http_code'] == 200 && $result['simplexml']) {
 
-      if ($result['simplexml']->getName() == 'CopyObjectResult')
+      if ($result['simplexml']->getName() == 'CopyObjectResult') {
         return $reference;
+      }
     }
 
     throw new StorageException();
   }
 
+  /**
+   * Converts an ETag to MD5 hash.
+   *
+   * @param string $etag
+   *   The ETag.
+   *
+   * @return string
+   *   The MD5 hash.
+   */
   private function eTag2md5($etag) {
     return pack('H*', substr($etag, 1, 32));
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceManifest(array &$sandbox, &$finished) {
 
     $query = array(
@@ -890,15 +1035,18 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     return $manifest;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceExists($reference) {
-
     $result = $this->request('HEAD', $this->settings['bucket'], $reference);
-
     return $result['http_code'] == 200;
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceCheck($reference) {
-
     $result = $this->request('HEAD', $this->settings['bucket'], $reference);
 
     if ($result['http_code'] != 200) {
@@ -911,6 +1059,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     );
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceGetUri($reference) {
 
     $result = $this->request('GET', $this->settings['bucket'], $reference);
@@ -918,6 +1069,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     return $result['temp_uri'];
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceDestroy($reference) {
 
     $result = $this->request('DELETE', $this->settings['bucket'], $reference);
@@ -927,6 +1081,9 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
   public function serviceInstanceServe($reference, $https) {
     $s3_object = '/' . drupal_encode_path($reference);
     $base_url = 'http' . ($https ? 's' : '') . '://';
@@ -937,19 +1094,23 @@ class StorageS3 extends StorageContainer implements StorageContainerInterface {
       if ($this->access_control) {
         $expires = time() + $this->settings['url_lifetime'];
         $policy = '{"Statement":[{"Resource":"' . $base_url . $s3_object . '","Condition":{"DateLessThan":{"AWS:EpochTime":' . $expires . '}}}]}';
-        $query['Policy'] = str_replace(array('+', '=', '/'), array('-', '_', '~'), base64_encode($policy));
+        $query['Policy'] = str_replace(array('+', '=', '/'), array(
+          '-',
+          '_',
+          '~',
+        ), base64_encode($policy));
         $query['Signature'] = $this->signature($policy, TRUE);
         $query['Key-Pair-Id'] = $this->settings['cf_key_id'];
       }
     }
     else {
-      if (https && strpos($this->settings['bucket'], '.') !== false) {
+      if ($https && strpos($this->settings['bucket'], '.') !== FALSE) {
         $base_url .= 's3.amazonaws.com/' . $this->settings['bucket'];
       }
       else {
         $base_url .= $this->settings['bucket'];
-        // If the bucket is a CNAME alias, the full domain name is not required unless we are
-        // serving over https.
+        // If the bucket is a CNAME alias, the full domain name is not required
+        // unless we are serving over https.
         if (!$this->settings['cname'] || $https) {
           $base_url .= '.s3.amazonaws.com';
         }
