diff --git a/README.txt b/README.txt
index f3d1bed..358db64 100644
--- a/README.txt
+++ b/README.txt
@@ -15,7 +15,8 @@ that you can enable as well.
 
 Installation and configuration:
 ------------------------------
-1.) Simply extract the download package in your modules directory, e.g. '/sites/all/modules'.
+1.) Simply extract the download package in your modules directory, 
+e.g. '/sites/all/modules'.
 2.) Enable the module in 'admin/modules'.
 3.) Configure the API Key '/admin/config/media/flickr'.
 4.) Add the flickr filter to one of your input formats by following
diff --git a/block/flickr_block.info b/block/flickr_block.info
index 5857baf..c9bba81 100644
--- a/block/flickr_block.info
+++ b/block/flickr_block.info
@@ -1,7 +1,7 @@
 name = Flickr Block
-description = Adds capability to display Flickr photos and sets into blocks.
-dependencies[] = flickr
-package = Flickr
+description = Display Flickr photos and sets in blocks.
 core = 7.x
+package = Flickr
+
+dependencies[] = flickr
 
-files[] = flickr_block.module
\ No newline at end of file
diff --git a/block/flickr_block.install b/block/flickr_block.install
index e789d59..a19e58b 100644
--- a/block/flickr_block.install
+++ b/block/flickr_block.install
@@ -1,12 +1,15 @@
 <?php
-
 /**
  * @file
  * The Flickr uninstall hook
  */
 
+/**
+ * Implements hook_install().
+ */
 function flickr_block_uninstall() {
-  foreach (range(0, 6) as $delta) {
+  foreach (range(0, 9) as $delta) {
     variable_del("flickr_block_{$delta}");
   }
 }
+
diff --git a/block/flickr_block.module b/block/flickr_block.module
index f9ef642..3e0ccf0 100644
--- a/block/flickr_block.module
+++ b/block/flickr_block.module
@@ -1,27 +1,31 @@
 <?php
+/**
+ * @file
+ * The Flickr block module
+ */
 
 /**
  * Implements hook_block_info().
  */
 function flickr_block_info() {
-  // User base blocks
+  // User base blocks.
   $blocks[0]['info'] = t("Flickr user page recent photos");
   $blocks[1]['info'] = t("Flickr user page photosets");
   $blocks[2]['info'] = t("Flickr user page random photos");
 
-  // Site wide blocks
+  // Site wide blocks.
   $blocks[3]['info'] = t('Flickr recent photos');
   $blocks[4]['info'] = t('Flickr recent photosets');
   $blocks[5]['info'] = t('Flickr random photos');
   $blocks[6]['info'] = t('Flickr group photos');
 
-  // Photoset blocks
+  // Photoset blocks.
   $blocks[7]['info'] = t('Flickr random photo from photoset');
   $blocks[8]['info'] = t('Flickr recent photo from photoset');
 
   // Returns a list of favorite public photos for the given user.
   $blocks[9]['info'] = t("Flickr user favorite public photos");
-    
+
   return $blocks;
 }
 
@@ -29,17 +33,38 @@ function flickr_block_info() {
  * Implements hook_block_configure().
  */
 function flickr_block_configure($delta = '') {
-  $count_options = array(1 => '1', 2 => '2', 3 => '3',  4 => '4', 5 => '5', 6 => '6', 7 => '7',  8 => '8', 9 => '9', 10 => '10', 15 => '15', 20 => '20', 25 => '25', 30 => '30');
-  
-  // remove the large and original sizes
+  $count_options = array(
+    1 => '1',
+    2 => '2',
+    3 => '3',
+    4 => '4',
+    5 => '5',
+    6 => '6',
+    7 => '7',
+    8 => '8',
+    9 => '9',
+    10 => '10',
+    15 => '15',
+    20 => '20',
+    25 => '25',
+    30 => '30',
+  );
+
+  // Remove the large and original sizes.
   $size_options = array();
   foreach (flickr_photo_sizes() as $size => $info) {
     $size_options[$size] = $info['label'] . ' - ' . $info['description'];
   }
   unset($size_options['b']);
   unset($size_options['o']);
-  
-  $settings = variable_get('flickr_block_' . $delta, array('user_id' => '', 'show_n' => 4, 'size' => 's','photoset_id' => '', 'media' => 'all'));
+
+  $settings = variable_get('flickr_block_' . $delta, array(
+    'user_id' => '',
+    'show_n' => 4,
+    'size' => 's',
+    'photoset_id' => '',
+    'media' => 'all',
+  ));
 
   $form = array();
   $user_id = array_key_exists('user_id', $settings) ? $settings['user_id'] : '';
@@ -47,62 +72,81 @@ function flickr_block_configure($delta = '') {
     '#type' => 'textfield',
     '#title' => t('Flickr User Id'),
     '#default_value' => $user_id,
-    '#description' => t("The user id of a Flickr user. If this is left blank, the sites's default user will be used. Current default id is " . variable_get('flickr_default_userid', '')),
+    '#description' => t("The user id of a Flickr user. If this is left blank, the sites's default user will be used. Current default id is") . " " . variable_get('flickr_default_userid', ''),
   );
   $form["flickr_block_{$delta}_show_n"] = array(
     '#type' => 'select',
     '#options' => $count_options,
     '#title' => t('Show <em>n</em> photos'),
     '#default_value' => $settings['show_n'],
-    '#description' => t("The block will display this many photos.")
+    '#description' => t("The block will display this many photos."),
   );
   $form["flickr_block_{$delta}_size"] = array(
     '#type' => 'select',
     '#options' => $size_options,
     '#title' => t('Size of photos'),
     '#default_value' => $settings['size'],
-    '#description' => t("Select the size of photos you'd like to display in the block.")
+    '#description' => t("Select the size of photos you'd like to display in the block."),
   );
-  
+
   $form["flickr_block_{$delta}_media"] = array(
     '#type' => 'select',
-    '#options' => array('all' => 'all', 'photos' => 'photos', 'videos' => 'videos'),
+    '#options' => array(
+      'all' => t('all'),
+      'photos' => t('photos'),
+      'videos' => t('videos'),
+    ),
     '#title' => t('Media type'),
     '#default_value' => $settings['media'],
-    '#description' => t("Filter results by media type.")
-  );  
+    '#description' => t("Filter results by media type."),
+  );
 
   switch ($delta) {
-    case 0: // user page, recent
+    // User page, recent.
+    case 0:
       unset($form["flickr_block_{$delta}_user_id"]);
       break;
-    case 1: // user page, photosets
+
+    // User page, photosets.
+    case 1:
       unset($form["flickr_block_{$delta}_user_id"]);
-      // photoset, not photos
+      // Photoset, not photos.
       $form["flickr_block_{$delta}_show_n"]['#title'] = t('Show the last <em>n</em> photosets');
       $form["flickr_block_{$delta}_show_n"]['#description'] = t("The block will show this many of the user's photosets.");
       unset($form["flickr_block_{$delta}_media"]);
       break;
-    case 2: // user page, random
+
+    // User page, random.
+    case 2:
       unset($form["flickr_block_{$delta}_user_id"]);
       break;
-      
-    case 3: // sitewide, recent
+
+    // Sitewide, recent.
+    case 3:
       break;
-    case 4: // sitewite photoset, not photos
+
+    // Sitewite photoset, not photos.
+    case 4:
       $form["flickr_block_{$delta}_show_n"]['#title'] = t('Show the last <em>n</em> photosets');
       $form["flickr_block_{$delta}_show_n"]['#description'] = t("The block will show this many of the user's photosets.");
       unset($form["flickr_block_{$delta}_media"]);
       break;
-    case 5: // sitewide, random
+
+    // Sitewide, random.
+    case 5:
       break;
-    case 6: // sitewide, group
+
+    // Sitewide, group.
+    case 6:
       $form["flickr_block_{$delta}_user_id"]['#title'] = t('Show photos from this Group ID');
       $form["flickr_block_{$delta}_user_id"]['#description'] = t('Will select photos from this group pool');
       $form["flickr_block_{$delta}_user_id"]['#required'] = TRUE;
       break;
-    case 7: // sitewide, random
-    case 8: // sitewide, recent
+
+    // Sitewide, random.
+    case 7:
+      // Sitewide, recent.
+    case 8:
       unset($form["flickr_block_{$delta}_user_id"]);
       $form["flickr_block_{$delta}_photoset"] = array(
         '#type' => 'textfield',
@@ -112,8 +156,11 @@ function flickr_block_configure($delta = '') {
         '#required' => TRUE,
       );
       break;
-    case 9: // list of favorite public photos for the given user
-      break;      
+
+    // List of favorite public photos for the given user.
+    case 9:
+      break;
+
   }
   return $form;
 }
@@ -121,7 +168,7 @@ function flickr_block_configure($delta = '') {
 /**
  * Implements hook_block_save().
  */
-function flickr_block_save($delta = '', $edit = array()) {  
+function flickr_block_save($delta = '', $edit = array()) {
   switch ($delta) {
     case 0:
     case 1:
@@ -132,12 +179,12 @@ function flickr_block_save($delta = '', $edit = array()) {
         'media' => $edit["flickr_block_{$delta}_media"],
       ));
       break;
-    
+
     case 3:
     case 4:
     case 5:
-    case 6: 
-    case 9: 
+    case 6:
+    case 9:
       variable_set('flickr_block_' . $delta, array(
         'user_id' => $edit["flickr_block_{$delta}_user_id"],
         'show_n' => (int) $edit["flickr_block_{$delta}_show_n"],
@@ -145,15 +192,17 @@ function flickr_block_save($delta = '', $edit = array()) {
         'media' => $edit["flickr_block_{$delta}_media"],
       ));
       break;
+
     case 7:
     case 8:
       variable_set('flickr_block_' . $delta, array(
         'show_n' => (int) $edit["flickr_block_{$delta}_show_n"],
         'size' => $edit["flickr_block_{$delta}_size"],
         'media' => $edit["flickr_block_{$delta}_media"],
-        'photoset_id' => $edit["flickr_block_{$delta}_photoset"],        
+        'photoset_id' => $edit["flickr_block_{$delta}_photoset"],
       ));
       break;
+
   }
 }
 
@@ -168,8 +217,8 @@ function flickr_block_view($delta = '') {
     'size' => 's',
     'media' => 'all',
   ));
-   
-  // Get the default user id as a fallback
+
+  // Get the default user id as a fallback.
   if (empty($settings['user_id'])) {
     $settings['user_id'] = variable_get('flickr_default_userid');
   }
@@ -180,7 +229,7 @@ function flickr_block_view($delta = '') {
     case 0:
     case 1:
     case 2:
-      // Get per user nsid if necessary
+      // Get per user nsid if necessary.
       if (arg(0) == 'user' && ($uid = (int) arg(1))) {
         if ($user = user_load($uid)) {
           if (!empty($user->flickr['nsid'])) {
@@ -199,91 +248,130 @@ function flickr_block_view($delta = '') {
             elseif ($delta == 9) {
               $block['subject'] = t("%username's favorite public Flickr photos", array('%username' => $user->name));
               $block['content'] = _flickr_block_favorite_public($user->flickr['nsid'], $settings['show_n'], $settings['size'], $settings['media']);
-            }            
+            }
           }
         }
       }
       break;
+
     case 3:
       $block['subject'] = t('Flickr recent photos');
       $block['content'] = _flickr_block_recent($settings['user_id'], $settings['show_n'], $settings['size'], $settings['media']);
       break;
+
     case 4:
       $block['subject'] = t('Flickr recent photosets');
       $block['content'] = _flickr_block_photosets($settings['user_id'], $settings['show_n'], $settings['size']);
       break;
+
     case 5:
       $block['subject'] = t('Flickr random photos');
       $block['content'] = _flickr_block_random($settings['user_id'], $settings['show_n'], $settings['size'], $settings['media']);
       break;
+
     case 6:
       $block['subject'] = t('Flickr Group photos');
       $block['content'] = _flickr_block_group_recent($settings['user_id'], $settings['show_n'], $settings['size'], $settings['media']);
       break;
+
     case 7:
       $block['subject'] = t('Flickr random photoset photos');
       $block['content'] = _flickr_block_photoset_random($settings['user_id'], $settings['show_n'], $settings['size'], $settings['media'], $settings['photoset_id']);
       break;
+
     case 8:
       $block['subject'] = t('Flickr recent photoset photos');
       $block['content'] = _flickr_block_photoset_recent($settings['user_id'], $settings['show_n'], $settings['size'], $settings['media'], $settings['photoset_id']);
       break;
+
     case 9:
       $block['subject'] = t('Flickr favorite public photos');
       $block['content'] = _flickr_block_favorite_public($settings['user_id'], $settings['show_n'], $settings['size'], $settings['media']);
       break;
-      
+
   }
   return $block;
-} 
+}
 
+/**
+ * Recent block.
+ */
 function _flickr_block_recent($nsid, $show_n, $size, $media) {
   $output = '';
-  if ($photos = flickr_photos_search($nsid, 1, array('per_page' => $show_n, 'media' => $media))) {
+  if ($photos = flickr_photos_search($nsid, 1, array(
+    'per_page' => $show_n,
+    'media' => $media,
+  ))) {
     foreach ($photos['photo'] as $photo) {
-      $output .= theme('flickr_block_photo', array('photo' => $photo, 'size' => $size));
+      $output .= theme('flickr_block_photo', array(
+        'photo' => $photo,
+        'size' => $size,
+      ));
     }
   }
   return $output;
 }
 
+/**
+ * Photoset block.
+ */
 function _flickr_block_photosets($nsid, $show_n, $size) {
   $photosets = flickr_photoset_get_list($nsid);
   $output = '';
   $to = min($show_n, count($photosets));
   for ($i = 0; $i < $to; $i++) {
-    $output .= theme('flickr_block_photoset', array('photoset' => $photosets[$i], 'owner' => $nsid, 'size' => $size));
+    $output .= theme('flickr_block_photoset', array(
+      'photoset' => $photosets[$i],
+      'owner' => $nsid,
+      'size' => $size,
+    ));
   }
   return $output;
 }
 
+/**
+ * Random from user block.
+ */
 function _flickr_block_random($nsid, $show_n, $size, $media) {
   $output = '';
   $random_photos = array();
-  if ($photos = flickr_photos_search($nsid, 1, array('per_page' => 500, 'media' => $media))) {
+  if ($photos = flickr_photos_search($nsid, 1, array(
+    'per_page' => 500,
+    'media' => $media,
+  ))) {
     $page_count = $photos['pages'];
-    // we shouldn't try to return more than the total number of photos
+    // Do not try to return more than the total number of photos.
     $to = min($show_n, $photos['total']);
     $output = '';
     for ($i = 0; $i < $to; $i++) {
       sleep(0.125);
-      // request a random page
-      $photos = flickr_photos_search($nsid, rand(1, $page_count), array('per_page' => 500, 'media' => $media));
-      // then select a random photo
+      // Request a random page.
+      $photos = flickr_photos_search($nsid, rand(1, $page_count), array(
+        'per_page' => 500,
+        'media' => $media,
+      ));
+      // Select a random photo.
       $index = rand(0, count($photos['photo']) - 1);
       $photo_id = $photos['photo'][$index]['id'];
       if (in_array($photo_id, $random_photos)) {
-        $i--; // photo already added 
-      } 
+        // Photo already added.
+        $i--;
+      }
       else {
-        $random_photos[] = $photo_id; 
-        $output .= theme('flickr_block_photo', array('photo' => $photos['photo'][$index], 'size' => $size)); 
+        $random_photos[] = $photo_id;
+        $output .= theme('flickr_block_photo', array(
+          'photo' => $photos['photo'][$index],
+          'size' => $size,
+        ));
       }
     }
-  } 
+  }
   return $output;
 }
 
+/**
+ * Random from photoset block.
+ */
 function _flickr_block_photoset_random($nsid, $show_n, $size, $media, $photoset_id) {
   // Get information about the photoset, including the owner.
   $info = flickr_photoset_get_info($photoset_id);
@@ -295,7 +383,8 @@ function _flickr_block_photoset_random($nsid, $show_n, $size, $media, $photoset_
   $response = flickr_request('flickr.photosets.getPhotos',
     array(
       'photoset_id' => $photoset_id,
-      'per_page' => 500, // get as many images as possible
+      // Get as many images as possible.
+      'per_page' => 500,
       'extras' => 'owner',
       'media' => $media,
     )
@@ -304,21 +393,27 @@ function _flickr_block_photoset_random($nsid, $show_n, $size, $media, $photoset_
     return;
   }
 
-  // Randomly display $show_n of them
+  // Randomly display $show_n of them.
   $photos = $response['photoset']['photo'];
   shuffle($photos);
 
-  // we shouldn't try to return more than the total number of photos
+  // We shouldn't try to return more than the total number of photos.
   $output = '';
   $to = min($show_n, count($photos));
   for ($i = 0; $i < $to; $i++) {
-    //insert owner into $photo because theme_flickr_photo needs it
+    // Insert owner into $photo because theme_flickr_photo needs it.
     $photos[$i]['owner'] = $info['owner'];
-    $output .= theme('flickr_block_photo', array('photo' => $photos[$i], 'size' => $size));
+    $output .= theme('flickr_block_photo', array(
+      'photo' => $photos[$i],
+      'size' => $size,
+    ));
   }
   return $output;
 }
 
+/**
+ * Recent from photoset block.
+ */
 function _flickr_block_photoset_recent($nsid, $show_n, $size, $media, $photoset_id) {
   // Get information about the photoset, including the owner.
   $info = flickr_photoset_get_info($photoset_id);
@@ -334,29 +429,57 @@ function _flickr_block_photoset_recent($nsid, $show_n, $size, $media, $photoset_
       'media' => $media,
     )
   );
-  
+
   if (!$response) {
     return;
   }
-  
+
   $output = '';
   foreach ($response['photoset']['photo'] as $photo) {
-    //insert owner into $photo because theme_flickr_photo needs it
+    // Insert owner into $photo because theme_flickr_photo needs it.
     $photo['owner'] = $info['owner'];
-    $output .= theme('flickr_block_photo', array('photo' => $photo, 'size' => $size));
+    $output .= theme('flickr_block_photo', array(
+      'photo' => $photo,
+      'size' => $size,
+    ));
+  }
+
+  return $output;
+}
+
+/**
+ * Favorites block.
+ */
+function _flickr_block_favorite_public($nsid, $show_n, $size, $media) {
+  $output = '';
+  if ($photos = flickr_favorites_get_public_list($nsid, 1, array(
+    'per_page' => $show_n,
+    'media' => $media,
+  ))) {
+    foreach ($photos['photo'] as $photo) {
+      $output .= theme('flickr_block_photo', array(
+        'photo' => $photo,
+        'size' => $size,
+      ));
+    }
   }
-  
   return $output;
 }
 
-/*
- * This renders a block with photos from the selected groupid
+/**
+ * This renders a block with photos from the selected groupid.
  */
 function _flickr_block_group_recent($groupid, $show_n, $size, $media) {
   $output = '';
-  if ($photos = flickr_get_group_photos($groupid, 1, array('per_page' => $show_n, 'media' => $media))) {
+  if ($photos = flickr_get_group_photos($groupid, 1, array(
+    'per_page' => $show_n,
+    'media' => $media,
+  ))) {
     foreach ($photos['photo'] as $photo) {
-      $output .= theme('flickr_block_photo', array('photo' => $photo, 'size' => $size));
+      $output .= theme('flickr_block_photo', array(
+        'photo' => $photo,
+        'size' => $size,
+      ));
     }
   }
   return $output;
@@ -376,25 +499,26 @@ function flickr_block_theme() {
   );
 }
 
+/**
+ * Theme photo blocks.
+ */
 function theme_flickr_block_photo($variables) {
   $photo = $variables['photo'];
   $size = $variables['size'];
   return theme('flickr_photo', array('photo' => $photo, 'size' => $size));
 }
 
+/**
+ * Theme photoset blocks.
+ */
 function theme_flickr_block_photoset($variables) {
   $photoset = $variables['photoset'];
   $owner = $variables['owner'];
   $size = $variables['size'];
-  return theme('flickr_photoset', array('photoset' => $photoset, 'owner' => $owner, 'size' => $size));
+  return theme('flickr_photoset', array(
+    'photoset' => $photoset,
+    'owner' => $owner,
+    'size' => $size,
+  ));
 }
 
-function _flickr_block_favorite_public($nsid, $show_n, $size, $media) {
-  $output = '';
-  if ($photos = flickr_favorites_get_public_list($nsid, 1, array('per_page' => $show_n, 'media' => $media))) {
-    foreach ($photos['photo'] as $photo) {
-      $output .= theme('flickr_block_photo', array('photo' => $photo, 'size' => $size));
-    }
-  }
-  return $output;
-}
\ No newline at end of file
diff --git a/field/flickrfield.info b/field/flickrfield.info
index ca5d5d7..e54a90f 100644
--- a/field/flickrfield.info
+++ b/field/flickrfield.info
@@ -1,10 +1,8 @@
 name = Flickr Field
-description = Flickr field to insert Flickr images into content.
+description = Add Flickr images to content as fields.
 core = 7.x
 package = Flickr
 
-dependencies[] = field
 dependencies[] = flickr
+dependencies[] = field
 
-files[] = flickrfield.install
-files[] = flickrfield.module
diff --git a/field/flickrfield.module b/field/flickrfield.module
index 6212b3b..3418def 100644
--- a/field/flickrfield.module
+++ b/field/flickrfield.module
@@ -1,10 +1,10 @@
 <?php
-
 /**
  * @file
  * Defines a Flickr field type.
  *
- * @todo - think about how to control access to photos, might be tricky because of CCK caching.
+ * @todo - think about how to control access to photos, might be tricky because
+ * of CCK caching.
  */
 
 /**
@@ -33,14 +33,14 @@ function flickrfield_field_info() {
     'flickrfield' => array(
       'label' => 'Flickr Photo',
       'description' => t('Store Flickr Photo or Photoset ids and display the photos in nodes and views.'),
-  		'default_widget' => 'flickrfield',
-  		'default_formatter' => $sizes[0],
+      'default_widget' => 'flickrfield',
+      'default_formatter' => $sizes[0],
     ),
     'flickrfield_photoset' => array(
       'label' => 'Flickr photo set',
       'description' => t('Field for storing a reference to a Flickr photo set.'),
-  		'default_widget' => 'flickrfield_flickrid',
-  		'default_formatter' => 'photoset_primaryphoto_size' . $sizes[0] . '_nolink',
+      'default_widget' => 'flickrfield_flickrid',
+      'default_formatter' => 'photoset_primaryphoto_size' . $sizes[0] . '_nolink',
     ),
   );
 }
@@ -50,15 +50,35 @@ function flickrfield_field_info() {
  */
 function flickrfield_field_schema($field) {
   if ($field['type'] == 'flickrfield') {
-  $columns = array(
-    'id' => array('type' => 'varchar', 'length' => 64, 'not null' => FALSE, 'sortable' => TRUE),
-    'type' => array('type' => 'varchar', 'length' => 10, 'not null' => FALSE, 'sortable' => TRUE),
-    'nsid' => array('type' => 'varchar', 'length' => 64, 'not null' => FALSE, 'sortable' => TRUE),
-  );
+    $columns = array(
+      'id' => array(
+        'type' => 'varchar',
+        'length' => 64,
+        'not null' => FALSE,
+        'sortable' => TRUE,
+      ),
+      'type' => array(
+        'type' => 'varchar',
+        'length' => 10,
+        'not null' => FALSE,
+        'sortable' => TRUE,
+      ),
+      'nsid' => array(
+        'type' => 'varchar',
+        'length' => 64,
+        'not null' => FALSE,
+        'sortable' => TRUE,
+      ),
+    );
   }
-  else if ($field['type'] == 'flickrfield_photoset') {
+  elseif ($field['type'] == 'flickrfield_photoset') {
     $columns = array(
-      'flickrid' => array('type' => 'varchar', 'length' => 64, 'not null' => FALSE, 'sortable' => TRUE),
+      'flickrid' => array(
+        'type' => 'varchar',
+        'length' => 64,
+        'not null' => FALSE,
+        'sortable' => TRUE,
+      ),
     );
   }
   return array('columns' => $columns);
@@ -72,26 +92,24 @@ function flickrfield_field_widget_info() {
     'flickrfield' => array(
       'label' => 'Flickr Photo',
       'field types' => array('flickrfield'),
-  		'behaviors' => array(
-  			'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+      'behaviors' => array(
+        'multiple values' => FIELD_BEHAVIOR_DEFAULT,
         'default value' => FIELD_BEHAVIOR_DEFAULT,
-  		),
+      ),
     ),
     'flickrfield_flickrid' => array(
       'label' => 'Flickr Id',
       'field types' => array('flickrfield_photoset'),
-  		'behaviors' => array(
-  			'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+      'behaviors' => array(
+        'multiple values' => FIELD_BEHAVIOR_DEFAULT,
         'default value' => FIELD_BEHAVIOR_DEFAULT,
-  		),
+      ),
     ),
   );
 }
 
 /**
  * Implements hook_element_info().
- *
-  * @todo - #columns is not mentioned as a possible attribute on http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_element_info/7
  */
 function flickrfield_element_info() {
   return array(
@@ -99,13 +117,13 @@ function flickrfield_element_info() {
       '#input' => TRUE,
       '#columns' => array('type', 'id', 'uid'),
       '#process' => array('flickrfield_form_process_flickrfield'),
-  		//'#theme' => array('theme_flickrfield'),
+      // '#theme' => array('theme_flickrfield'),
     ),
     'flickrfield_flickrid' => array(
       '#input' => TRUE,
       '#columns' => array('flickrid'),
       '#process' => array('flickrfield_form_process_flickrfield_flickrid'),
-  		//'#theme' => array('theme_flickrfield_flickrid'),
+      // '#theme' => array('theme_flickrfield_flickrid'),
     ),
   );
 }
@@ -114,7 +132,7 @@ function flickrfield_element_info() {
  * Implements hook_field_widget_form().
  */
 function flickrfield_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
-	$element = array(
+  $element = array(
     '#type' => $instance['widget']['type'],
     '#default_value' => isset($items[$delta]) ? $items[$delta] : '',
   );
@@ -158,7 +176,7 @@ function flickrfield_form_process_flickrfield_flickrid($element, $form_state, $f
     '#title' => !empty($element['#title']) ? $element['#title'] : '',
     '#description' => !empty($element['#description']) ? $element['#description'] : '',
     '#required' => FALSE || $element['#required'],
-    '#field_prefix' => t('Flickr set ID: '),
+    '#field_prefix' => t('Flickr set ID') . ': ',
     '#default_value' => !empty($element['#value']['flickrid']) ? $element['#value']['flickrid'] : '',
     '#size' => 20,
     '#maxlength' => 20,
@@ -174,7 +192,7 @@ function flickrfield_field_is_empty($item, $field) {
   if ($field['type'] == 'flickrfield') {
     return empty($item['id']);
   }
-  else if ($field['type'] == 'flickrfield_photoset') {
+  elseif ($field['type'] == 'flickrfield_photoset') {
     return empty($item['flickrid']);
   }
 }
@@ -192,7 +210,7 @@ function flickrfield_field_formatter_info() {
       'field types' => array('flickrfield'),
     );
   }
-  
+
   // Formatters for Flickr photoset field.
   foreach ($sizes as $size => $info) {
     $formatters['photoset_primaryphoto_size' . $size . '_nolink'] = array(
@@ -221,28 +239,32 @@ function flickrfield_field_formatter_info() {
 
 /**
  * Implements hook_field_formatter_view().
- * @todo: the theme definitions for our field-formatters should be removed from flickrfield_theme() and implemented here
- * @see http://drupal.org/node/728792 (section "Changed! Hook Formatter")
+ * @todo: the theme definitions for our field-formatters should be removed from
+ * flickrfield_theme() and implemented here
+ * @ see
+ *   http://drupal.org/node/728792 (section "Changed! Hook Formatter")
  */
 function flickrfield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
-	$element = array();
-	$sizes = array_keys(flickr_photo_sizes());
-	foreach ($items as $delta => $item) {
-		$variables = array(
-			'#node' => $entity,
-			'#item' => $item,
-			'#formatter' => $display['type'], 
-			'#field_name' => $field['field_name'],
-		);
-		$element[$delta]['#markup'] = theme('flickrfield_formatter_' . $display['type'], $variables);
-	}
+  $element = array();
+  $sizes = array_keys(flickr_photo_sizes());
+  foreach ($items as $delta => $item) {
+    $variables = array(
+      '#node' => $entity,
+      '#item' => $item,
+      '#formatter' => $display['type'],
+      '#field_name' => $field['field_name'],
+    );
+    $element[$delta]['#markup'] = theme('flickrfield_formatter_' . $display['type'], $variables);
+  }
   return $element;
 }
 
 /**
  * Implements hook_theme().
- * @todo: the theme definitions for our field-formatters should go in flickrfield_field_formatter_view()
- * @see http://drupal.org/node/728792 (section "Changed! Hook Formatter")
+ * @todo: the theme definitions for our field-formatters should go in
+ * flickrfield_field_formatter_view()
+ * @ see
+ *   http://drupal.org/node/728792 (section "Changed! Hook Formatter")
  */
 function flickrfield_theme() {
   require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'flickr') . '/flickr.inc';
@@ -268,10 +290,22 @@ function flickrfield_theme() {
   }
   return $themes + array(
     'flickrfield_photo' => array(
-      'variables' => array('img', 'photo_url', 'formatter', 'photo_data', 'node'),
+      'variables' => array(
+        'img',
+        'photo_url',
+        'formatter',
+        'photo_data',
+        'node',
+      ),
     ),
     'flickrfield_photoset' => array(
-      'variables' => array('img', 'photo_url', 'formatter', 'photo_data', 'node'),
+      'variables' => array(
+        'img',
+        'photo_url',
+        'formatter',
+        'photo_data',
+        'node',
+      ),
     ),
     'flickrfield' => array(
       'variables' => array('element'),
@@ -308,12 +342,25 @@ function theme_flickrfield_field_formatter($element) {
       $photo_data = flickr_photo_get_info($item['id']);
       $img = flickr_img($photo_data, $formatter);
       $photo_url = flickr_photo_page_url($photo_data['owner'], $photo_data['id']);
-      return theme('flickrfield_photo', array('0' => $img, '1' => $photo_url, '2' => $formatter, '3' => $photo_data, '4' => $node));
+      return theme('flickrfield_photo', array(
+        '0' => $img,
+        '1' => $photo_url,
+        '2' => $formatter,
+        '3' => $photo_data,
+        '4' => $node,
+      ));
+
     case 'set_id':
       $photo_data = flickr_photoset_get_info($item['id']);
       $img = flickr_img($photo_data, $formatter);
       $photo_url = flickr_photoset_page_url($photo_data['owner'], $photo_data['id']);
-      return theme('flickrfield_photoset', array('0' => $img, '1' => $photo_url, '2' => $formatter, '3' => $photo_data, '4' => $node));
+      return theme('flickrfield_photoset', array(
+        '0' => $img,
+        '1' => $photo_url,
+        '2' => $formatter,
+        '3' => $photo_data,
+        '4' => $node,
+      ));
   }
 }
 
@@ -334,9 +381,11 @@ function theme_flickrfield_formatter_photoset_primaryphoto($element) {
     case 'linknode':
       $link = 'node/' . $element['#node']->nid;
       break;
+
     case 'linkflickrcomset':
       $link = $set_url;
       break;
+
     default:
       $link = NULL;
       break;
@@ -363,7 +412,7 @@ function theme_flickrfield_formatter_photoset_flickrcomslideshow($variables) {
 }
 
 /**
- * Theme a Flickr photo set as a simple link to the photo set page on Flickr.com.
+ * Theme a Flickr photoset as a simple link to the photoset page on Flickr.com.
  */
 function theme_flickrfield_formatter_photoset_flickrcomsetlink($variables) {
   $set_data = flickr_photoset_get_info($variables['#item']['flickrid']);
@@ -389,7 +438,10 @@ function theme_flickrfield_photo($variables) {
     $output = '<div class="flickr-photo-img">' . $img . '</div>';
   }
   else {
-    $output = '<div class="flickr-photo-img">' . l($img, 'node/' . $node->nid, array('attributes' => array('title' => $title), 'absolute' => TRUE, 'html' => TRUE)) . '</div>';
+    $output = '<div class="flickr-photo-img">' . l($img, 'node/' . $node->nid, array(
+      'attributes' => array('title' => $title),
+      'absolute' => TRUE, 'html' => TRUE,
+    )) . '</div>';
   }
   $output .= '<div class="flickr-citation"><cite>' . l(t('Source: Flickr'), $photo_url) . '</cite></div>';
   return $output;
@@ -410,17 +462,23 @@ function theme_flickrfield_photoset($variables) {
     $photos = flickr_set_load($photo_data['id']);
 
     foreach ((array) $photos['photoset']['photo'] as $photo) {
-      //insert owner into $photo because theme_flickr_photo needs it
+      // Insert owner into $photo because theme_flickr_photo needs it.
       $photo['owner'] = $photos['photoset']['owner'];
       $title = is_array($photo['title']) ? $photo['title']['_content'] : $photo['title'];
       $img = flickr_img($photo, $formatter);
       $original = flickr_photo_img($photo);
 
       if (arg(0) == 'node' && arg(1) == $node->nid) {
-        $output .= '<div class="flickr-photoset-img flickr-photoset-img-' . $formatter . '">' . l($img, $original, array('attributes' => array('title' => $title), 'absolute' => TRUE, 'html' => TRUE)) . '</div>';
+        $output .= '<div class="flickr-photoset-img flickr-photoset-img-' . $formatter . '">' . l($img, $original, array(
+          'attributes' => array('title' => $title),
+          'absolute' => TRUE, 'html' => TRUE,
+        )) . '</div>';
       }
       else {
-        $output .= '<div class="flickr-photoset-img flickr-photoset-img-' . $formatter . '">' . l($img, 'node/' . $node->nid, array('attributes' => array('title' => $title), 'absolute' => TRUE, 'html' => TRUE)) . '</div>';
+        $output .= '<div class="flickr-photoset-img flickr-photoset-img-' . $formatter . '">' . l($img, 'node/' . $node->nid, array(
+          'attributes' => array('title' => $title),
+          'absolute' => TRUE, 'html' => TRUE,
+        )) . '</div>';
       }
     }
   }
@@ -431,7 +489,10 @@ function theme_flickrfield_photoset($variables) {
       $output .= '<div class="flickr-photoset-img">' . $img . '</div>';
     }
     else {
-      $output .= '<div class="flickr-photoset-img">' . l($img, 'node/' . $node->nid, array('attributes' => array('title' => $title), 'absolute' => TRUE, 'html' => TRUE)) . '</div>';
+      $output .= '<div class="flickr-photoset-img">' . l($img, 'node/' . $node->nid, array(
+        'attributes' => array('title' => $title),
+        'absolute' => TRUE, 'html' => TRUE,
+      )) . '</div>';
     }
 
   }
@@ -445,13 +506,22 @@ function theme_flickrfield_photoset($variables) {
 
 /**
  * Theme function for showing a primary photo of a photo set with optional link.
- * Also includes a link to Flickr.com photo set page to comply with terms of service.
- * @param $img HTML code for image
- * @param $link link to which the image should link to
- * @param $set_url url of the photo set on Flickr.com
- * @param $size the flickr size of the image
- * @param $title title to use for the link
- * @return unknown_type
+ * Also includes a link to Flickr.com photo set page to comply with terms of
+ * service.
+ *
+ * @param string $img
+ *   HTML code for image.
+ * @param string $link
+ *   Link to which the image should link to.
+ * @param string $set_url
+ *   URL of the photo set on Flickr.com.
+ * @param string $size
+ *   The flickr size of the image.
+ * @param string $title
+ *   Title to use for the link.
+ *
+ * @return string
+ *   HTML to render.
  */
 function theme_flickrfield_photoset_primaryphoto($variables) {
   $img = $variables['0'];
@@ -460,7 +530,10 @@ function theme_flickrfield_photoset_primaryphoto($variables) {
   $size = $variables['3'];
   $title = $variables['4'];
   if ($link) {
-    $output = '<div class="flickr-photoset-img">' . l($img, $link, array('attributes' => array('title' => $title), 'html' => TRUE)) . '</div>';
+    $output = '<div class="flickr-photoset-img">' . l($img, $link, array(
+      'attributes' => array('title' => $title),
+      'html' => TRUE,
+    )) . '</div>';
   }
   else {
     $output = '<div class="flickr-photoset-img">' . $img . '</div>';
@@ -472,8 +545,8 @@ function theme_flickrfield_photoset_primaryphoto($variables) {
 /**
  * Theme for the form element.
  *
- * The form is already rendered by the child elements by the time it comes back here,
- * just group each delta grouping into its own fieldset.
+ * The form is already rendered by the child elements by the time it comes back
+ * here, just group each delta grouping into its own fieldset.
  */
 function theme_flickrfield($variables) {
   $element = $variables['0'];
diff --git a/filter/flickr_filter.info b/filter/flickr_filter.info
index 8a6660b..3dd4f30 100644
--- a/filter/flickr_filter.info
+++ b/filter/flickr_filter.info
@@ -1,7 +1,7 @@
 name = Flickr Filter
 description = Adds a filter to insert Flickr photos and sets into content.
-dependencies[] = flickr
-package = Flickr
 core = 7.x
+package = Flickr
+
+dependencies[] = flickr
 
-files[] = flickr_filter.module
\ No newline at end of file
diff --git a/filter/flickr_filter.module b/filter/flickr_filter.module
index f84155e..e4f7c87 100644
--- a/filter/flickr_filter.module
+++ b/filter/flickr_filter.module
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ * The Flickr filter module.
+ */
 
 require_once(drupal_get_path('module', 'flickr') . '/flickr.inc');
 
@@ -6,19 +10,19 @@ require_once(drupal_get_path('module', 'flickr') . '/flickr.inc');
  * Implements hook_filter_info().
  */
 function flickr_filter_info() {
-  $filters['filter_flickr'] = array(
-    'title' =>  t('Flickr linker'),
+  $filters['flickr_filter'] = array(
+    'title' => t('Flickr linker'),
     'description' => t('Allows you to Insert Flickr images: [flickr-photo:id=230452326,size=s] or [flickr-photoset:id=72157594262419167,size=m].'),
-    'process callback' => '_filter_flickr',
-    'tips callback' => '_filter_flickr_tips',
+    'process callback' => 'flickr_filter',
+    'tips callback' => 'flickr_filter_tips',
   );
   return $filters;
 }
 
 /**
- * Returns the filter information for the filter help page
+ * Returns the filter information for the filter help page.
  */
-function _filter_flickr_tips($filter, $format, $long = FALSE) {
+function flickr_filter_tips($filter, $format, $long = FALSE) {
   $output = t('Insert Flickr images: [flickr-photo:id=7357144724,size=m] or [flickr-photoset:id=72157594262419167,size=s].<br />Common sizes:<br /> s : small square 75<br /> t : thumbnail, 100 on longest side<br /> q : big square 150<br /> m : small, 240 on longest side<br /> n : small, 320 on longest side<br /> - : medium, 500 on longest side<br /> If wrong size is used, check if size exists on Flickr > Actions > View all sizes.');
   if ($long) {
     $output .= ' ' . t('The size parameter can be one of the following:');
@@ -32,9 +36,9 @@ function _filter_flickr_tips($filter, $format, $long = FALSE) {
 }
 
 /**
- * Processes the flickr filter
+ * Processes the flickr filter.
  */
-function _filter_flickr($text, $filter) {
+function flickr_filter($text, $filter) {
   $text = preg_replace_callback('/\[flickr-photo:(.+?)\]/', 'flickr_filter_callback_photo', $text);
   $text = preg_replace_callback('/\[flickr-photoset:(.+?)\]/', 'flickr_filter_callback_photoset', $text);
   return $text;
@@ -42,19 +46,19 @@ function _filter_flickr($text, $filter) {
 
 /**
  * Parse parameters to the fiter from a format like:
- *   id=26159919@N00, size=m,show = 9, class=something,style=float:left;border:1px
+ * id=26159919@N00, size=m,show = 9, class=something,style=float:left;border:1px
  * into an associative array with two sub-arrays. The first sub-array is
  * parameters for the request, the second are HTML attributes (class and style).
  */
 function flickr_filter_split_config($string) {
   $config = array();
   $attribs = array();
-  // put each setting on its own line
+  // Put each setting on its own line.
   $string = str_replace(',', "\n", $string);
-  // break them up around commas
+  // Break them up around commas.
   preg_match_all('/([a-zA-Z]+)=([-@0-9a-zA-Z:;]+)/', $string, $parts, PREG_SET_ORDER);
   foreach ($parts as $part) {
-    // normalize to lower case and remove extra spaces
+    // Normalize to lowercase and remove extra spaces.
     $name = strtolower(trim($part[1]));
     $value = trim($part[2]);
     if ($name == 'style' || $name == 'class') {
@@ -74,8 +78,14 @@ function flickr_filter_callback_photo($matches) {
   list($config, $attribs) = flickr_filter_split_config($matches[1]);
   if (isset($config['id'])) {
     if ($photo = flickr_photo_get_info($config['id'])) {
-if(!isset($config['size'])) $config['size']= variable_get('flickr_default_size', '-');
-      return theme('flickr_filter_photo', array('photo' => $photo, 'size' => $config['size'], 'attribs' => $attribs));
+      if (!isset($config['size'])) {
+        $config['size'] = variable_get('flickr_default_size', 'm');
+      }
+      return theme('flickr_filter_photo', array(
+        'photo' => $photo,
+        'size' => $config['size'],
+        'attribs' => $attribs,
+      ));
     }
   }
   return '';
@@ -89,7 +99,12 @@ function flickr_filter_callback_photoset($matches) {
 
   if (isset($config['id'])) {
     if ($photoset = flickr_photoset_get_info($config['id'])) {
-      return theme('flickr_filter_photoset', array('photoset' => $photoset, 'owner' => $photoset['owner'], 'size' => $config['size'], 'attribs' => $attribs));
+      return theme('flickr_filter_photoset', array(
+        'photoset' => $photoset,
+        'owner' => $photoset['owner'],
+        'size' => $config['size'],
+        'attribs' => $attribs,
+      ));
     }
   }
   return '';
@@ -109,10 +124,17 @@ function flickr_filter_theme() {
   );
 }
 
+/**
+ * Theme single photo.
+ */
 function theme_flickr_filter_photo($variables) {
   return theme('flickr_photo', $variables);
 }
 
+/**
+ * Theme photoset.
+ */
 function theme_flickr_filter_photoset($variables) {
   return theme('flickr_photoset', $variables);
-}
\ No newline at end of file
+}
+
diff --git a/flickr.admin.inc b/flickr.admin.inc
index 55dc1fd..5d293ae 100644
--- a/flickr.admin.inc
+++ b/flickr.admin.inc
@@ -1,12 +1,11 @@
 <?php
-
 /**
  * @file
  * The admin settings for the Flickr module
  */
 
 /**
- * Implementation of hook_settings
+ * Implements hook_settings().
  */
 function flickr_admin_settings() {
   $form['flickr_api_key'] = array(
@@ -21,7 +20,7 @@ function flickr_admin_settings() {
     '#title' => t('API Shared Secret'),
     '#required' => TRUE,
     '#default_value' => variable_get('flickr_api_secret', ''),
-    '#description' => t('API key\'s secret from Flickr.'),
+    '#description' => t("API key's secret from Flickr."),
   );
   $form['flickr_default_userid'] = array(
     '#type' => 'textfield',
@@ -29,7 +28,19 @@ function flickr_admin_settings() {
     '#default_value' => variable_get('flickr_default_userid', ''),
     '#description' => t('An, optional, default Flickr username or user id. This will be used when no user is specified.'),
   );
-  $times = array(900, 1800, 2700, 3600, 7200, 10800, 14400, 18000, 21600, 43200, 86400);
+  $times = array(
+    900,
+    1800,
+    2700,
+    3600,
+    7200,
+    10800,
+    14400,
+    18000,
+    21600,
+    43200,
+    86400,
+  );
   $ageoptions = drupal_map_assoc($times, 'format_interval');
   $form['flickr_cache_duration'] = array(
     '#type' => 'select',
@@ -59,7 +70,7 @@ function flickr_admin_settings() {
     $form['flickr_default_size'] = array(
       '#type' => 'select',
       '#title' => t('Default size'),
-      '#default_value' => variable_get('flickr_default_size', '-'),
+      '#default_value' => variable_get('flickr_default_size', 'm'),
       '#options' => array(
         's' => t('s: 75 px square'),
         't' => t('t: 100 px on longest side'),
@@ -111,7 +122,7 @@ function flickr_admin_settings() {
     ),
     '#description' => t('The image size to open in the overlay browser when clicking the image. Larger sizes make navigating to next and previous pictures slower.<br />After saving the configuration, <a href="?q=admin/config/development/performance">clear the cache</a>.<br />!: TAKE CARE, n (320px) and c (800px) sizes are missing on many "older" Flickr images!'),
   );
-  // we need an api key before we can verify usernames
+  // We need an api key before we can verify usernames.
   if (!$form['flickr_api_key']['#default_value']) {
     $form['flickr_default_userid']['#disabled'] = TRUE;
     $form['flickr_default_userid']['#description'] .= t('Disabled until a valid API Key is set.');
@@ -120,6 +131,9 @@ function flickr_admin_settings() {
   return system_settings_form($form);
 }
 
+/**
+ * Validate user input.
+ */
 function flickr_admin_settings_validate($form, &$form_state) {
   $key = trim($form_state['values']['flickr_api_key']);
   $sec = trim($form_state['values']['flickr_api_secret']);
@@ -133,7 +147,7 @@ function flickr_admin_settings_validate($form, &$form_state) {
   }
   if ($uid) {
     if (flickr_is_nsid($uid)) {
-      // it's already a uid
+      // It's already a uid.
     }
     else {
       $user = flickr_user_find_by_username($uid);
@@ -144,14 +158,17 @@ function flickr_admin_settings_validate($form, &$form_state) {
   }
 }
 
+/**
+ * Submit form data.
+ */
 function flickr_admin_settings_submit($form, &$form_state) {
-  // clean up the data ...
+  // Clean up the data.
   $form_state['values']['flickr_api_key'] = trim($form_state['values']['flickr_api_key']);
   $form_state['values']['flickr_api_secret'] = trim($form_state['values']['flickr_api_secret']);
   $form_state['values']['flickr_photos_per_page'] = trim($form_state['values']['flickr_photos_per_page']);
   $form_state['values']['flickr_default_userid'] = trim($form_state['values']['flickr_default_userid']);
 
-  // ... replace the usernames with a user id ...
+  // Replace the usernames with a uid.
   if (!flickr_is_nsid($form_state['values']['flickr_default_userid'])) {
     $username = $form_state['values']['flickr_default_userid'];
     if ($user = flickr_user_find_by_username($username)) {
@@ -160,6 +177,7 @@ function flickr_admin_settings_submit($form, &$form_state) {
     }
   }
 
-  // ... and save the settings
+  // Save the settings.
   system_settings_form_submit($form, $form_state);
-}
\ No newline at end of file
+}
+
diff --git a/flickr.api.inc b/flickr.api.inc
index 115d807..15b5bb6 100644
--- a/flickr.api.inc
+++ b/flickr.api.inc
@@ -1,13 +1,19 @@
 <?php
+/**
+ * @file
+ * Flickr API functions.
+ */
 
-// TODO: Would like to implement a consistent naming for drupal wrapper functions around flick API methods 
-// e.g covert a "." to an "underscore" only  i.e for flickr.photos.getInfo use flickr_photos_getinfo()
-
+// TODO: Would like to implement a consistent naming for drupal wrapper
+// functions around flick API methods e.g covert a "." to an "underscore" only
+// i.e for flickr.photos.getInfo use flickr_photos_getinfo()
 /**
- * @param $photo_id
- *   id of the photo to get info about
+ * Get information about a photo.
  *
- * @return
+ * @param string $photo_id
+ *   ID of the photo to get info about.
+ *
+ * @return array
  *   response from the flickr method flickr.photos.getInfo
  *   (http://www.flickr.com/services/api/flickr.photos.getInfo.html)
  */
@@ -23,10 +29,12 @@ function flickr_photo_get_info($photo_id) {
 }
 
 /**
- * @param $photo_id
- *   id of the photo to get the available sizes of
+ * Returns the available sizes for a photo.
+ *
+ * @param string $photo_id
+ *   ID of the photo to get the available sizes of.
  *
- * @return
+ * @return array
  *   response from the flickr method flickr.photos.getSizes
  *   (http://www.flickr.com/services/api/flickr.photos.getSizes.html)
  */
@@ -42,23 +50,24 @@ function flickr_photo_get_sizes($photo_id) {
 }
 
 /**
- * @param $nsid
- *   nsid of the user whose photoset tags will be returned
- * @param $page   
- *   page of results to return
+ * Return a list of photos matching some criteria.
  *
- * @return
+ * @param string $nsid
+ *   NSID of the user whose photoset tags will be returned.
+ * @param string $page
+ *   Page of results to return.
+ *
+ * @return array
  *   response from the flickr method flickr.photos.search
  *   (http://www.flickr.com/services/api/flickr.photos.search.html)
  */
-
-function flickr_photos_search($nsid, $page = 1, $other_args = array()){
-  $args = array (
+function flickr_photos_search($nsid, $page = 1, $other_args = array()) {
+  $args = array(
     'user_id' => $nsid,
     'page' => $page,
   );
 
-  //set per_page to flickr module default if it is not specified in $other_args
+  // Set per_page to flickr module default if not specified in $other_args.
   if (!isset($other_args['per_page'])) {
     $args['per_page'] = variable_get('flickr_photos_per_page', 20);
   }
@@ -71,22 +80,24 @@ function flickr_photos_search($nsid, $page = 1, $other_args = array()){
 }
 
 /**
- * @param $nsid
- *   nsid of the user whose photoset tags will be returned
- * @param $page   
- *   page of results to return
+ * Returns a list of favorite public photos for the given user.
+ *
+ * @param string $nsid
+ *   NSID of the user whose photoset tags will be returned.
+ * @param string $page
+ *   Page of results to return.
  *
- * @return
+ * @return array
  *   response from the flickr method flickr.favorites.getPublicList
  *   (http://www.flickr.com/services/api/flickr.favorites.getPublicList.html)
  */
-function flickr_favorites_get_public_list($nsid, $page = 1, $other_args = array()){
-  $args = array (
+function flickr_favorites_get_public_list($nsid, $page = 1, $other_args = array()) {
+  $args = array(
     'user_id' => $nsid,
     'page' => $page,
   );
 
-  //set per_page to flickr module default if it is not specified in $other_args
+  // Set per_page to flickr module default if not specified in $other_args.
   if (!isset($other_args['per_page'])) {
     $args['per_page'] = variable_get('flickr_photos_per_page', 20);
   }
@@ -99,10 +110,12 @@ function flickr_favorites_get_public_list($nsid, $page = 1, $other_args = array(
 }
 
 /**
- * @param $photoset_id
- *   id of the photoset to get information about
+ * Gets information about a photoset.
  *
- * @return
+ * @param string $photoset_id
+ *   ID of the photoset to get information about.
+ *
+ * @return array
  *   response from the flickr method flickr.photosets.getInfo
  *   (http://www.flickr.com/services/api/flickr.photosets.getInfo.html)
  */
@@ -118,10 +131,12 @@ function flickr_photoset_get_info($photoset_id) {
 }
 
 /**
- * @param $nsid
- *   nsid of the user whose photoset list you want
+ * Returns the photosets belonging to the specified user.
+ *
+ * @param string $nsid
+ *   NSID of the user whose photoset list you want.
  *
- * @return
+ * @return array
  *   response from the flickr method flickr.photosets.getList
  *   (http://www.flickr.com/services/api/flickr.photosets.getList.html)
  */
@@ -137,10 +152,12 @@ function flickr_photoset_get_list($nsid) {
 }
 
 /**
- * @param $photoset_id
- * 
+ * Get the list of photos in a set.
  *
- * @return
+ * @param string $photoset_id
+ *   The Flickr photoset ID.
+ *
+ * @return array
  *   response from the flickr method flickr.photosets.getPhotos
  *   (http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
  */
@@ -150,8 +167,7 @@ function flickr_photoset_get_photos($photoset_id) {
     'photoset_id' => $photoset_id,
     'per_page' => 500,
     'extras' => 'owner',
-    )
-  );
+  ));
   if ($response) {
     return $response;
   }
@@ -159,9 +175,12 @@ function flickr_photoset_get_photos($photoset_id) {
 }
 
 /**
- * @param $nsid The Flickr user's NSID
+ * Get information about a user.
+ *
+ * @param string $nsid
+ *   The Flickr user's NSID.
  *
- * @return
+ * @return array
  *   array with person's info from flickr.people.getInfo
  *   (http://www.flickr.com/services/api/flickr.people.getInfo.html)
  *   or FALSE on error.
@@ -178,12 +197,12 @@ function flickr_people_get_info($nisd) {
 }
 
 /**
- * Lookup an nsid for a username.
+ * Return a user's NSID, given their username.
  *
- * @param $username
+ * @param string $username
  *   username to look for
  *
- * @return
+ * @return array
  *   response from the flickr method flickr.people.findByUsername
  *   (http://www.flickr.com/services/api/flickr.people.findByUsername.html)
  */
@@ -199,12 +218,12 @@ function flickr_user_find_by_username($username) {
 }
 
 /**
- * Lookup an nsid for an email address
+ * Return a user's NSID, given their email address.
  *
- * @param $email
- *   email to look for
+ * @param string $email
+ *   Email to look for.
  *
- * @return
+ * @return array
  *   response from the flickr method flickr.people.findByEmail
  *   (http://www.flickr.com/services/api/flickr.people.findByEmail.html)
  */
@@ -220,17 +239,19 @@ function flickr_user_find_by_email($email) {
 }
 
 /**
- * @param $nsid
- *   nsid of the user whose tags will be returned
- * @param $count
- *   number of tags to return
+ * Get the popular tags for a given user.
  *
- * @return
+ * @param string $nsid
+ *   NSID of the user whose tags will be returned.
+ * @param string $count
+ *   Number of tags to return.
+ *
+ * @return array
  *   response from the flickr method flickr.tags.getListUserPopular
  *   (http://www.flickr.com/services/api/flickr.tags.getListUserPopular.html)
  */
-function flickr_tags_get_list_user_popular($nsid, $count=NULL) {
-  $args = array('user_id'=>$nsid);
+function flickr_tags_get_list_user_popular($nsid, $count = NULL) {
+  $args = array('user_id' => $nsid);
   if ($count != NULL) {
     $args['count'] = $count;
   }
@@ -242,14 +263,16 @@ function flickr_tags_get_list_user_popular($nsid, $count=NULL) {
 }
 
 /**
- * @param $nsid
- *   nsid of the user whose photoset tags will be returned
+ * Get the tag list for a given user.
+ *
+ * @param string $nsid
+ *   NSID of the user whose photoset tags will be returned.
  *
- * @return
+ * @return array
  *   response from the flickr method flickr.tags.getListUser
  *   (http://www.flickr.com/services/api/flickr.tags.getListUser.html)
  */
-function flickr_tags_get_list_user($nsid){
+function flickr_tags_get_list_user($nsid) {
   $response = flickr_request(
     'flickr.tags.getListUser',
     array('user_id' => $nsid)
@@ -260,22 +283,24 @@ function flickr_tags_get_list_user($nsid){
   return FALSE;
 }
 
-
+// TODO: Change name to flickr_groups_pools_get_photos()?
 /**
- * @param $nid
- *   nsid of the group whose photos you want
+ * Returns a list of pool photos for a given group.
+ *
+ * @param string $nid
+ *   NSID of the group whose photos you want.
  *
- * @return
+ * @return array
  *   response from the flickr method flickr.groups.pools.getPhotos
  *   (http://www.flickr.com/services/api/flickr.groups.pools.getPhotos.html)
-*/
-function flickr_get_group_photos($nsid, $page = 1, $other_args = array()){ // TODO change name to flickr_groups_pools_get_photos() ?
-  $args = array (
+ */
+function flickr_get_group_photos($nsid, $page = 1, $other_args = array()) {
+  $args = array(
     'group_id' => $nsid,
     'page' => $page,
   );
 
-  //set per_page to flickr module default if it is not specified in $other_args
+  // Set per_page to flickr module default if not specified in $other_args.
   if (!isset($other_args['per_page'])) {
     $args['per_page'] = variable_get('flickr_photos_per_page', 20);
   }
@@ -286,3 +311,4 @@ function flickr_get_group_photos($nsid, $page = 1, $other_args = array()){ // TO
   }
   return FALSE;
 }
+
diff --git a/flickr.css b/flickr.css
index 1ca6086..cc5928a 100644
--- a/flickr.css
+++ b/flickr.css
@@ -1,7 +1,3 @@
-.flickr-photos {}
-
-.flickr-photo {}
-
 .flickr-photo-img {
   vertical-align: text-bottom;
 }
@@ -14,10 +10,6 @@
   height: 260px;
 }
 
-.flickr-photosets {}
-
-.flickr-photoset span.flickr-wrap{}
-
 .flickr-photoset-img {
   vertical-align: text-bottom;
 }
@@ -30,10 +22,6 @@
   height: 130px;
 }
 
-.flickr-photoset-title {}
-
-.flickr-photoset-count {}
-
 span.flickr-wrap {
   display: inline-block;
   vertical-align: top;
diff --git a/flickr.inc b/flickr.inc
index 5de806b..bdf932b 100644
--- a/flickr.inc
+++ b/flickr.inc
@@ -1,67 +1,66 @@
 <?php
-
 /**
  * @file
- * The Flickr API functions
+ * The Flickr API functions.
  */
 
 define('FLICKR_REST_ENDPOINT', 'http://api.flickr.com/services/rest/');
 
 /**
- * Return a list of all possible photo sizes with the right
- * description and label
+ * A list of possible photo sizes with description and label.
  *
- * @return An array of photo sizes
+ * @return array
+ *   An array of photo sizes.
  */
 function flickr_photo_sizes() {
   return array(
     's' => array(
       'label' => 'Square',
-      'description' => t('75 px square'),
+      'description' => t('s: 75 px square'),
     ),
     't' => array(
       'label' => 'Thumbnail',
-      'description' => t('100 px on longest side'),
+      'description' => t('t: 100 px on longest side'),
     ),
     'q' => array(
       'label' => 'Large Square',
-      'description' => t('150 px square'),
+      'description' => t('q: 150 px square'),
     ),
     'm' => array(
       'label' => 'Small',
-      'description' => t('240 px on longest side'),
+      'description' => t('m: 240 px on longest side'),
     ),
     'n' => array(
       'label' => 'Small 320',
-      'description' => t('320 px on longest side'),
+      'description' => t('n: 320 px on longest side'),
     ),
     '-' => array(
       'label' => 'Medium',
-      'description' => t('500 px on longest side'),
+      'description' => t('-: 500 px on longest side'),
     ),
     'z' => array(
       'label' => 'Medium 640',
-      'description' => t('640 px on longest side'),
+      'description' => t('z: 640 px on longest side'),
     ),
     'c' => array(
       'label' => 'Medium 800',
-      'description' => t('800 px on longest side'),
+      'description' => t('c: 800 px on longest side'),
     ),
     'b' => array(
       'label' => 'Large',
-      'description' => t('1024 px on longest side'),
+      'description' => t('b: 1024 px on longest side'),
     ),
     'h' => array(
       'label' => 'Large 1600',
-      'description' => t('1600 px on longest side'),
+      'description' => t('h: 1600 px on longest side'),
     ),
     'k' => array(
       'label' => 'Large 2048',
-      'description' => t('2048 px on longest side'),
+      'description' => t('k: 2048 px on longest side'),
     ),
     'o' => array(
       'label' => 'Original',
-      'description' => t('Original image')
+      'description' => t('o: Original image'),
     ),
   );
 };
@@ -69,16 +68,16 @@ function flickr_photo_sizes() {
 /**
  * Submit a request to Flickr.
  *
- * @param $method
- *   string method name
- * @param $args
- *   associative array of arguments names and values
- * @param $cacheable
- *   boolean indicating if it's safe cache the results of this request
- * @param $return_errors
- *   boolean indicating if the caller will handle displaying error messages
+ * @param string $method
+ *   String method name.
+ * @param string $args
+ *   Associative array of arguments names and values.
+ * @param string $cacheable
+ *   Boolean indicating if it's safe cache the results of this request.
+ * @param string $return_errors
+ *   Boolean indicating if the caller will handle displaying error messages.
  *
- * @return
+ * @return array
  *   an array with the the result of the request, or FALSE on error.
  */
 function flickr_request($method, $args, $cacheable = TRUE, $return_errors = FALSE) {
@@ -88,7 +87,7 @@ function flickr_request($method, $args, $cacheable = TRUE, $return_errors = FALS
   $args['format'] = 'php_serial';
   ksort($args);
 
-  // Build an argument hash API signing (we'll also use it for the cache id)
+  // Build an argument hash API signing (we'll also use it for the cache id).
   $arg_hash = '';
   foreach ($args as $k => $v) {
     $arg_hash .= $k . $v;
@@ -102,7 +101,7 @@ function flickr_request($method, $args, $cacheable = TRUE, $return_errors = FALS
   foreach ($args as $k => $v) {
     $encoded_params[] = urlencode($k) . '=' . urlencode($v);
   }
-  $url = FLICKR_REST_ENDPOINT . '?' . implode('&', $encoded_params);  
+  $url = FLICKR_REST_ENDPOINT . '?' . implode('&', $encoded_params);
 
   // If it's a cachable request, try to load a cached value.
   if ($cacheable) {
@@ -120,8 +119,9 @@ function flickr_request($method, $args, $cacheable = TRUE, $return_errors = FALS
     if ($return_errors) {
       return array(
         'stat' => 'error',
-        //In Drupal <= 5.1, only HTTP errors are stored in $result->code correctly, not TCP/IP errors.
-        //We can not count on this variable being correct until this module requires Drupal 5.2 or above.
+        // In Drupal <= 5.1, only HTTP errors are stored in $result->code
+        // correctly, not TCP/IP errors. We can not count on this variable being
+        // correct until this module requires Drupal 5.2 or above.
         'code' => $result->code,
         'message' => $result->error,
       );
@@ -165,14 +165,14 @@ function flickr_request($method, $args, $cacheable = TRUE, $return_errors = FALS
  * This function will try to create a html image tag referencing the Flickr
  * photo with the desired size if that size is available for this photo.
  *
- * @param $photo
- *   the photo variable
- * @param $size
- *   the desired image size
- * @param $attribs
- *   an optional array of HTML attributes to pass to the image
+ * @param string $photo
+ *   The photo variable.
+ * @param string $size
+ *   The desired image size.
+ * @param string $attributes
+ *   An optional array of HTML attributes to pass to the image.
  *
- * @return
+ * @return array
  *   a html image tag referencing the image of the desired
  *   size if it is available.
  */
@@ -194,11 +194,17 @@ function flickr_img($photo, $size = NULL, $attributes = NULL) {
   // photoset's use primary instead of id to specify the image.
   if (isset($photo['primary'])) {
     $id = $photo['primary'];
-    $attributes['class'] = implode(' ', array($attributes['class'], 'flickr-photoset-img'));
+    $attributes['class'] = implode(' ', array(
+      $attributes['class'],
+      'flickr-photoset-img',
+    ));
   }
   else {
     $id = $photo['id'];
-    $attributes['class'] = implode(' ', array($attributes['class'], 'flickr-photo-img'));
+    $attributes['class'] = implode(' ', array(
+      $attributes['class'],
+      'flickr-photo-img',
+    ));
   }
 
   if ($size == 's') {
@@ -224,25 +230,31 @@ function flickr_img($photo, $size = NULL, $attributes = NULL) {
     }
   }
   $title = is_array($photo['title']) ? $photo['title']['_content'] : $photo['title'];
-  return theme('image', array('path' => $img_url, 'alt' => $title, 'title' => $title, 'attributes' => $attributes, 'getsize' => FALSE));
+  return theme('image', array(
+    'path' => $img_url,
+    'alt' => $title,
+    'title' => $title,
+    'attributes' => $attributes,
+    'getsize' => FALSE,
+  ));
 }
 
 /**
- * Create the url to $photo with size $size using the correct image farm
- * from the $photo variable
- *
- * @param $photo
- *   photo to which the url should point
- * @param $size
- *   size of the photo
- * @param $format
- *   format of the photo
- *
- * @return
- *   url for $photo with the correct size and format
+ * Returns the URL to $photo with size $size using the correct image farm
+ * from the $photo variable.
+ *
+ * @param string $photo
+ *   Photo to which the url should point.
+ * @param string $size
+ *   Size of the photo.
+ * @param string $format
+ *   Format of the photo.
+ *
+ * @return array
+ *   URL for $photo with the correct size and format.
  */
 function flickr_photo_img($photo, $size = NULL, $format = NULL) {
-  // early images don't have a farm setting so default to 1.
+  // Early images don't have a farm setting so default to 1.
   $farm = isset($photo['farm']) ? $photo['farm'] : 1;
   $server = $photo['server'];
   // photoset's use primary instead of id to specify the image.
@@ -253,16 +265,18 @@ function flickr_photo_img($photo, $size = NULL, $format = NULL) {
 }
 
 /**
- * @param $owner
- *   owner of the photo
- * @param $id
- *   id of the photo to reference in the url
+ * Returns the URL for the Flick photo page.
+ *
+ * @param string $owner
+ *   Owner of the photo.
+ * @param string $id
+ *   ID of the photo to reference in the URL.
  *
- * @return
- *   url for the flickr photo page showing photo with $id of $owner
+ * @return array
+ *   URL for the flickr photo page showing photo with $id of $owner.
  */
 function flickr_photo_page_url($owner, $id = NULL) {
-  $nsid = is_array($owner) ? $owner['nsid']: $owner;
+  $nsid = is_array($owner) ? $owner['nsid'] : $owner;
   if ($person = flickr_people_get_info($nsid)) {
     return $person['photosurl']['_content'] . $id;
   }
@@ -272,16 +286,18 @@ function flickr_photo_page_url($owner, $id = NULL) {
 }
 
 /**
- * @param $owner
- *   owner of the photoset
- * @param $id
- *   id of the photoset to which the url must lead
+ * Returns the URL of a given photoset page.
+ *
+ * @param string $owner
+ *   Owner of the photoset.
+ * @param string $id
+ *   ID of the photoset to which the url must lead.
  *
- * @return
- *   url for the photoset page of photoset $id of owner $owner
+ * @return array
+ *   URL for the photoset page of photoset $id of owner $owner.
  */
 function flickr_photoset_page_url($owner, $id = NULL) {
-  $nsid = is_array($owner) ? $owner['nsid']: $owner;
+  $nsid = is_array($owner) ? $owner['nsid'] : $owner;
   if ($person = flickr_people_get_info($nsid)) {
     return $person['photosurl']['_content'] . 'sets/' . $id;
   }
@@ -291,11 +307,13 @@ function flickr_photoset_page_url($owner, $id = NULL) {
 }
 
 /**
- * @param $photo_id
- *   id of the photo to get info about
+ * Get information about a photo.
  *
- * @return
- *   response from the flickr method flickr.photos.getInfo
+ * @param string $photo_id
+ *   ID of the photo to get info about.
+ *
+ * @return array
+ *   Response from the flickr method flickr.photos.getInfo.
  *   (http://www.flickr.com/services/api/flickr.photos.getInfo.html)
  */
 function flickr_photo_get_info($photo_id) {
@@ -310,11 +328,13 @@ function flickr_photo_get_info($photo_id) {
 }
 
 /**
- * @param $photo_id
- *   id of the photo to get the available sizes of
+ * Returns the available sizes for a photo.
+ *
+ * @param string $photo_id
+ *   ID of the photo to get the available sizes of.
  *
- * @return
- *   response from the flickr method flickr.photos.getSizes
+ * @return array
+ *   Response from the flickr method flickr.photos.getSizes.
  *   (http://www.flickr.com/services/api/flickr.photos.getSizes.html)
  */
 function flickr_photo_get_sizes($photo_id) {
@@ -329,11 +349,13 @@ function flickr_photo_get_sizes($photo_id) {
 }
 
 /**
- * @param $photoset_id
- *   id of the photoset to get information about
+ * Gets information about a photoset.
+ *
+ * @param string $photoset_id
+ *   ID of the photoset to get information about.
  *
- * @return
- *   response from the flickr method flickr.photosets.getInfo
+ * @return array
+ *   Response from the flickr method flickr.photosets.getInfo.
  *   (http://www.flickr.com/services/api/flickr.photosets.getInfo.html)
  */
 function flickr_photoset_get_info($photoset_id) {
@@ -348,11 +370,13 @@ function flickr_photoset_get_info($photoset_id) {
 }
 
 /**
- * @param $nsid
- *   nsid of the user whose photoset list you want
+ * Returns the photosets belonging to the specified user.
  *
- * @return
- *   response from the flickr method flickr.photosets.getList
+ * @param string $nsid
+ *   NSID of the user whose photoset list you want.
+ *
+ * @return array
+ *   Response from the flickr method flickr.photosets.getList.
  *   (http://www.flickr.com/services/api/flickr.photosets.getList.html)
  */
 function flickr_photoset_get_list($nsid) {
@@ -367,10 +391,13 @@ function flickr_photoset_get_list($nsid) {
 }
 
 /**
- * @param $nsid The Flickr user's NSID
+ * Get information about a user.
+ *
+ * @param string $nsid
+ *   The Flickr user's NSID.
  *
- * @return
- *   array with person's info from flickr.people.getInfo
+ * @return array
+ *   Array with person's info from flickr.people.getInfo.
  *   (http://www.flickr.com/services/api/flickr.people.getInfo.html)
  *   or FALSE on error.
  */
@@ -386,7 +413,7 @@ function flickr_people_get_info($nisd) {
 }
 
 /**
- * Tries to match an 'identifier' onto a flickr nsid
+ * Tries to match an 'identifier' onto a flickr nsid.
  *
  * This function will first see whether $identifier is already
  * a nsid (format check only, no api call).  If it is not and the
@@ -397,15 +424,15 @@ function flickr_people_get_info($nisd) {
  *
  * If none of these succeed, the result will be false
  *
- * @param $identifier
- *   identifier to find an nsid for
+ * @param string $identifier
+ *   Identifier to find an NSID for.
  *
- * @return
- *   valid nsid or false if none can be found
+ * @return array
+ *   Valid NSID or false if none can be found.
  */
 function flickr_user_find_by_identifier($identifier) {
   if (flickr_is_nsid($identifier)) {
-    //identifier is an NSID
+    // Identifier is an NSID.
     return $identifier;
   }
   if (valid_email_address($identifier) && ($user = flickr_user_find_by_email($identifier))) {
@@ -418,18 +445,21 @@ function flickr_user_find_by_identifier($identifier) {
   return FALSE;
 }
 
+/**
+ * Flickr is NSID.
+ */
 function flickr_is_nsid($id) {
   return preg_match('/^\d+@N\d+$/', $id);
 }
 
 /**
- * Lookup an nsid for a username.
+ * Return a user's NSID, given their username.
  *
- * @param $username
- *   username to look for
+ * @param string $username
+ *   Username to look for.
  *
- * @return
- *   response from the flickr method flickr.people.findByUsername
+ * @return array
+ *   Response from the flickr method flickr.people.findByUsername.
  *   (http://www.flickr.com/services/api/flickr.people.findByUsername.html)
  */
 function flickr_user_find_by_username($username) {
@@ -444,13 +474,13 @@ function flickr_user_find_by_username($username) {
 }
 
 /**
- * Lookup an nsid for an email address
+ * Return a user's NSID, given their email address.
  *
- * @param $email
- *   email to look for
+ * @param string $email
+ *   Email to look for.
  *
- * @return
- *   response from the flickr method flickr.people.findByEmail
+ * @return array
+ *   Response from the flickr method flickr.people.findByEmail.
  *   (http://www.flickr.com/services/api/flickr.people.findByEmail.html)
  */
 function flickr_user_find_by_email($email) {
@@ -465,16 +495,18 @@ function flickr_user_find_by_email($email) {
 }
 
 /**
- * @param $nsid
- *   nsid of the user whose tags will be returned
- * @param $count
- *   number of tags to return
+ * Get the popular tags for a given user.
+ *
+ * @param string $nsid
+ *   NSID of the user whose tags will be returned.
+ * @param string $count
+ *   Number of tags to return.
  *
- * @return
- *   response from the flickr method flickr.tags.getListUserPopular
+ * @return array
+ *   Response from the flickr method flickr.tags.getListUserPopular.
  *   (http://www.flickr.com/services/api/flickr.tags.getListUserPopular.html)
  */
-function flickr_tags_get_list_user_popular($nsid, $count=NULL) {
+function flickr_tags_get_list_user_popular($nsid, $count = NULL) {
   $args = array('user_id' => $nsid);
   if ($count != NULL) {
     $args['count'] = $count;
@@ -487,11 +519,13 @@ function flickr_tags_get_list_user_popular($nsid, $count=NULL) {
 }
 
 /**
- * @param $nsid
- *   nsid of the user whose photoset tags will be returned
+ * Get the tag list for a given user.
  *
- * @return
- *   response from the flickr method flickr.tags.getListUser
+ * @param string $nsid
+ *   NSID of the user whose photoset tags will be returned.
+ *
+ * @return array
+ *   Response from the flickr method flickr.tags.getListUser.
  *   (http://www.flickr.com/services/api/flickr.tags.getListUser.html)
  */
 function flickr_tags_get_list_user($nsid) {
@@ -506,13 +540,16 @@ function flickr_tags_get_list_user($nsid) {
 }
 
 
+/**
+ * Flickr photos search.
+ */
 function flickr_photos_search($nsid, $page = 1, $other_args = array()) {
   $args = array(
     'user_id' => $nsid,
     'page' => $page,
   );
 
-  //set per_page to flickr module default if it is not specified in $other_args
+  // Set per_page to flickr module default if not specified in $other_args.
   if (!isset($other_args['per_page'])) {
     $args['per_page'] = variable_get('flickr_photos_per_page', 20);
   }
@@ -524,6 +561,9 @@ function flickr_photos_search($nsid, $page = 1, $other_args = array()) {
   return FALSE;
 }
 
+/**
+ * Flickr tag request.
+ */
 function flickr_tag_request_args($tags = array(), $mode = 'all') {
   $args = array();
   if (!empty($tags)) {
@@ -534,24 +574,23 @@ function flickr_tag_request_args($tags = array(), $mode = 'all') {
 }
 
 /**
- * Check if the response from the Flickr api call was an error
+ * Check if the response from the Flickr api call was an error.
  *
- * @param $response
- *   response to check
+ * @param string $response
+ *   Response to check.
  *
- * @return
- *    true if the response is an error message
+ * @return array
+ *   True if the response is an error message.
  */
 function flickr_response_has_error($response) {
   return !(isset($response['stat']) && $response['stat'] == 'ok');
 }
 
 /**
- * Display an error message to flickr administrators and write an error to
- * watchdog.
+ * Display an error message to flickr admins and write an error to watchdog.
  *
- * @param $messageOrResponse
- *   message or error response to display
+ * @param string $message_or_response
+ *   Message or error response to display.
  */
 function flickr_set_error($message_or_response) {
   if (is_array($message_or_response)) {
@@ -571,20 +610,22 @@ function flickr_set_error($message_or_response) {
 }
 
 /**
- * @param $nid
- *   nsid of the group whose photos you want
+ * Returns the photosets belonging to the specified user.
  *
- * @return
- *   response from the flickr method flickr.photosets.getList
+ * @param string $nsid
+ *   NSID of the group whose photos you want.
+ *
+ * @return array
+ *   Response from the flickr method flickr.photosets.getList.
  *   (http://www.flickr.com/services/api/flickr.photosets.getList.html)
-*/
+ */
 function flickr_get_group_photos($nsid, $page = 1, $other_args = array()) {
   $args = array(
     'group_id' => $nsid,
     'page' => $page,
   );
 
-  //set per_page to flickr module default if it is not specified in $other_args
+  // Set per_page to flickr module default if not specified in $other_args.
   if (!isset($other_args['per_page'])) {
     $args['per_page'] = variable_get('flickr_photos_per_page', 20);
   }
@@ -597,22 +638,24 @@ function flickr_get_group_photos($nsid, $page = 1, $other_args = array()) {
 }
 
 /**
- * @param $nsid
- *   nsid of the user whose photoset tags will be returned
- * @param $page   
- *   page of results to return
+ * Returns a list of favorite public photos for the given user.
+ *
+ * @param string $nsid
+ *   NSID of the user whose photoset tags will be returned.
+ * @param string $page
+ *   Page of results to return.
  *
- * @return
+ * @return array
  *   response from the flickr method flickr.favorites.getPublicList
  *   (http://www.flickr.com/services/api/flickr.favorites.getPublicList.html)
  */
-function flickr_favorites_get_public_list($nsid, $page = 1, $other_args = array()){
-  $args = array (
+function flickr_favorites_get_public_list($nsid, $page = 1, $other_args = array()) {
+  $args = array(
     'user_id' => $nsid,
     'page' => $page,
   );
 
-  //set per_page to flickr module default if it is not specified in $other_args
+  // Set per_page to flickr module default if not specified in $other_args.
   if (!isset($other_args['per_page'])) {
     $args['per_page'] = variable_get('flickr_photos_per_page', 20);
   }
@@ -622,4 +665,5 @@ function flickr_favorites_get_public_list($nsid, $page = 1, $other_args = array(
     return $response['photos'];
   }
   return FALSE;
-}
\ No newline at end of file
+}
+
diff --git a/flickr.info b/flickr.info
index f5edfe3..7a00028 100644
--- a/flickr.info
+++ b/flickr.info
@@ -1,6 +1,5 @@
 name = Flickr
 description = Flickr and Drupal integration.
-package = Flickr
 core = 7.x
+package = Flickr
 
-files[] = flickr.module
\ No newline at end of file
diff --git a/flickr.install b/flickr.install
index fdcc1ea..a579bdb 100644
--- a/flickr.install
+++ b/flickr.install
@@ -1,42 +1,52 @@
 <?php
-
 /**
  * @file
  * The Flickr database schema and uninstall hook
  */
 
+/**
+ * Implements hook_uninstall().
+ */
 function flickr_uninstall() {
   variable_del('flickr_api_key');
   variable_del('flickr_api_secret');
-  variable_del('flickr_default_userid');  
   variable_del('flickr_cache_duration');
   variable_del('flickr_class');
+  variable_del('flickr_css');
+  variable_del('flickr_default_size');
+  variable_del('flickr_default_userid');
+  variable_del('flickr_opening_size');
+  variable_del('flickr_photos_per_page');
   variable_del('flickr_rel');
 }
 
+/**
+ * Implements hook_schema().
+ */
 function flickr_schema() {
   $schema['flickr_users'] = array(
-    'description' => t('Connects Drupal users to their Flickr accounts.'),
+    'description' => 'Connects Drupal users to their Flickr accounts.',
     'fields' => array(
       'uid' => array(
         'type' => 'int',
         'not null' => TRUE,
-        'description' => t('Primary Key: Drupal user ID'),
+        'description' => 'Primary Key: Drupal user ID',
       ),
       'nsid' => array(
         'type' => 'varchar',
         'length' => 64,
         'not null' => TRUE,
-        'description' => t('Flickr NSID'),
+        'description' => 'Flickr NSID',
       ),
       'identifier' => array(
         'type' => 'varchar',
         'length' => 64,
         'not null' => TRUE,
-        'description' => t('Flickr identifier'),
+        'description' => 'Flickr identifier',
       ),
     ),
     'primary key' => array('uid'),
   );
   return $schema;
 }
+
diff --git a/flickr.module b/flickr.module
index 8018fbb..4663a52 100644
--- a/flickr.module
+++ b/flickr.module
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ * The Flickr module.
+ */
 
 require_once(drupal_get_path('module', 'flickr') . '/flickr.inc');
 
@@ -8,7 +12,10 @@ require_once(drupal_get_path('module', 'flickr') . '/flickr.inc');
 function flickr_init() {
   // Determine the setting to use flickr.css or not.
   if (variable_get('flickr_css', 1)) {
-    drupal_add_css(drupal_get_path('module', 'flickr') . '/flickr.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
+    drupal_add_css(drupal_get_path('module', 'flickr') . '/flickr.css', array(
+      'group' => CSS_DEFAULT,
+      'every_page' => TRUE,
+    ));
   }
 }
 
@@ -64,16 +71,33 @@ function flickr_menu() {
 function flickr_theme() {
   return array(
     'flickr_photo' => array(
-      'variables' => array('size' => NULL, 'format' => NULL, 'attribs' => NULL),
+      'variables' => array(
+        'size' => NULL,
+        'format' => NULL,
+        'attribs' => NULL,
+      ),
     ),
     'flickr_photo_box' => array(
-      'variables' => array('photo', 'size' => NULL, 'format' => NULL, 'attribs' => NULL),
+      'variables' => array(
+        'photo',
+        'size' => NULL,
+        'format' => NULL,
+        'attribs' => NULL,
+      ),
     ),
     'flickr_photos' => array(
-      'variables' => array('uid' => NULL, 'photos' => NULL),
+      'variables' => array(
+        'uid' => NULL,
+        'photos' => NULL,
+      ),
     ),
     'flickr_photoset' => array(
-      'variables' => array('photoset', 'owner', 'size', 'attribs' => NULL),
+      'variables' => array(
+        'photoset',
+        'owner',
+        'size',
+        'attribs' => NULL,
+      ),
     ),
   );
 }
@@ -84,9 +108,10 @@ function flickr_theme() {
 function flickr_help($section, $arg) {
   switch ($section) {
     case 'admin/settings/flickr':
-      return t("You will need a Flickr API key to use this module. You can apply for one at <a href='@link'>@link</a>", array('@link' => url('http://www.flickr.com/services/api/keys/apply/')));
+      return t("You will need a Flickr API key to use this module. You can apply for one at <a href='@link'>@link</a>", array('@link' => url('http://www.flickr.com/services/apps/create/apply')));
+
     case 'admin/help#flickr':
-      return t('The flickr module uses XML-RPC to connect to Flickr\'s API and retreive photo information.');
+      return t("The flickr module uses XML-RPC to connect to Flickr's API and retreive photo information.");
   }
 }
 
@@ -102,28 +127,31 @@ function flickr_permission() {
 }
 
 /**
- * Displays the links to the user's photos, sets and tags
+ * Displays the links to the user's photos, sets and tags.
  */
 function flickr_user_page($user) {
   drupal_set_title(flickr_photos_page_title($user));
-  $links['items'][] = l(t('@name\'s photos', array('@name' => $user->name)), 'flickr/' . $user->uid);
+  $links['items'][] = l(t("@name's photos", array('@name' => $user->name)), 'flickr/' . $user->uid);
 
   if (module_exists('flickr_sets')) {
-    $links['items'][]  = l(t('@name\'s photo sets', array('@name' => $user->name)), 'flickr/' . $user->uid . '/sets');
+    $links['items'][]  = l(t("@name's photo sets", array('@name' => $user->name)), 'flickr/' . $user->uid . '/sets');
   }
 
   if (module_exists('flickr_tags')) {
-	$links['items'][]  = l(t('@name\'s tags', array('@name' => $user->name)), 'flickr/' . $user->uid . '/tags');		
+    $links['items'][]  = l(t("@name's tags", array('@name' => $user->name)), 'flickr/' . $user->uid . '/tags');
   }
-  return theme('item_list', $links) . ' ';	
+  return theme('item_list', $links) . ' ';
 }
 
+/**
+ * Flickr photo access.
+ */
 function flickr_photos_access($account) {
   $view_access = FALSE;
   if (!empty($account) && !empty($account->uid)) {
     if (isset($account->flickr['nsid'])) {
       $view_access = user_access('administer flickr') ||
-        // Only admins can view blocked accounts
+        // Only admins can view blocked accounts.
         $account->status && (
           user_access('view all flickr photos') ||
           user_access('view own flickr photos') && $GLOBALS['user']->uid == $account->uid
@@ -133,10 +161,12 @@ function flickr_photos_access($account) {
   return $view_access;
 }
 
+/**
+ * Flickr photos.
+ */
 function flickr_photos($user = NULL) {
-
   global $pager_page_array, $pager_total, $pager_total_items;
-  //set this to something else if you want multiple pagers
+  // Set this to something else if you want multiple pagers.
   $element = 0;
   $pager_page_array[$element] = empty($_GET['page']) ? 0 : (int) $_GET['page'];
 
@@ -167,7 +197,7 @@ function flickr_photos($user = NULL) {
     return FALSE;
   }
 
-  //set pager information we just acquired
+  // Set pager information we just acquired.
   $pager_total[$element] = $photos['pages'];
   $pager_total_items[$element] = $photos['total'];
 
@@ -175,8 +205,7 @@ function flickr_photos($user = NULL) {
 }
 
 /**
- * Implements hook_user_load()
- * Adds the Flickr variables to the user object
+ * Implements hook_user_load(). Adds the Flickr variables to the user object.
  */
 function flickr_user_load($users) {
   $result = db_query('SELECT * FROM {flickr_users} WHERE uid IN (:uids)', array(':uids' => array_keys($users)));
@@ -194,8 +223,7 @@ function flickr_user_presave(&$edit, $account, $category) {
     db_delete('flickr_users')
       ->condition('uid', $account->uid)
       ->execute();
-    //$user_affected = db_affected_rows();
-    
+    // $user_affected = db_affected_rows();
     if (!empty($edit['flickr_identifier'])) {
       $id = db_insert('flickr_users')
         ->fields(array(
@@ -218,7 +246,7 @@ function flickr_user_presave(&$edit, $account, $category) {
 /**
  * Implements hook_user_delete().
  */
-function hook_user_delete($account) {
+function flickr_user_delete($account) {
   db_delete('flickr_users')
     ->condition('uid', $account->uid)
     ->execute();
@@ -226,7 +254,7 @@ function hook_user_delete($account) {
 
 /**
  * Implements hook_form_user_profile_form_alter().
- * Adds the Flickr form to the user profile form
+ * Adds the Flickr form to the user profile form.
  */
 function flickr_form_user_profile_form_alter(&$form, &$form_state) {
   if ($form['#user_category'] == 'account' && (user_access('view own flickr photos') || user_access('administer flickr'))) {
@@ -250,7 +278,7 @@ function flickr_form_user_profile_form_alter(&$form, &$form_state) {
 }
 
 /**
- * Validates the users Flickr account by calling flickr_user_find_by_identifier()
+ * Validates a user's Flickr account calling flickr_user_find_by_identifier().
  */
 function flickr_user_account_form_validate(&$form, &$form_state) {
   if (!empty($form_state['values']['flickr_identifier'])) {
@@ -260,10 +288,16 @@ function flickr_user_account_form_validate(&$form, &$form_state) {
   }
 }
 
+/**
+ * Flickr photos page title.
+ */
 function flickr_photos_page_title($user) {
   return 'Flickr photos - ' . $user->name;
 }
 
+/**
+ * Theme Flickr photo.
+ */
 function theme_flickr_photo($variables) {
   $class = variable_get('flickr_class');
   $rel = variable_get('flickr_rel');
@@ -272,48 +306,77 @@ function theme_flickr_photo($variables) {
   $format = $variables['format'];
   $attribs = $variables['attribs'];
   $url = flickr_photo_img($photo, variable_get('flickr_opening_size', ''), $format);
-  switch($size) {
-  case 's':
-    $width = '75';
-    break;
-  case 't':
-    $width = '100';
-    break;
-  case 'q':
-    $width = '150';
-    break;
-  case 'm':
-    $width = '240';
-    break;
-  case 'n':
-    $width = '320';
-    break;
-  default:
-    $width = '500';
+  switch ($size) {
+    case 's':
+      $width = '75';
+      break;
+
+    case 't':
+      $width = '100';
+      break;
+
+    case 'q':
+      $width = '150';
+      break;
+
+    case 'm':
+      $width = '240';
+      break;
+
+    case 'n':
+      $width = '320';
+      break;
+
+    default:
+      $width = '500';
   }
   $img = flickr_img($photo, $size, $attribs);
   $photo_url = flickr_photo_page_url($photo['owner'], $photo['id']);
   $title = is_array($photo['title']) ? $photo['title']['_content'] : $photo['title'];
   if ($size == 's') {
-    $credit = t('Flickr'); // The size is too small to add a title.
+    // The size is too small to add a title.
+    $credit = t('Flickr');
   }
   else {
     $credit = $title;
   }
   if (variable_get('flickr_class') == NULL && variable_get('flickr_rel') == NULL) {
-    return l($img, $photo_url, array('attributes' => array('title' => $title), 'absolute' => TRUE, 'html' => TRUE));
+    return l($img, $photo_url, array(
+      'attributes' => array(
+        'title' => $title,
+      ),
+      'absolute' => TRUE,
+      'html' => TRUE,
+    ));
   }
   else {
-    return '<span class="flickr-wrap">' . l($img, $url, array('attributes' => array('title' => $title, 'class' => array($class), 'rel' => $rel), 'absolute' => TRUE, 'html' => TRUE)). '<span class="flickr-credit" style="max-width: ' . $width . 'px;">' . l($credit, $photo_url, array('attributes' => array('title' => t('View on Flickr. To enlarge click pic.'), 'target' => '_blank'))) . '</span></span>'; //Final step that generates the image with a link to the bigger version and a link to the Flickr page under it to comply with the TOS of Flickr.
+    // Final step that generates the image with a link to the bigger version and
+    // a link to the Flickr page under it to comply with the TOS of Flickr.
+    return '<span class="flickr-wrap">' . l($img, $url, array(
+      'attributes' => array(
+        'title' => $title,
+        'class' => array($class),
+        'rel' => $rel),
+      'absolute' => TRUE,
+      'html' => TRUE,
+    )) . '<span class="flickr-credit" style="max-width: ' . $width . 'px;">' . l($credit, $photo_url, array(
+      'attributes' => array(
+        'title' => t('View on Flickr. To enlarge click pic.'),
+        'target' => '_blank',
+      ),
+    )) . '</span></span>';
   }
 }
 
+/**
+ * Theme Flickr photo box.
+ */
 function theme_flickr_photo_box($variables) {
   $photo = $variables['photo'];
   $size = $variables['size'];
   $format = $variables['format'];
   $attribs = $variables['attribs'];
-  
+
   $img = flickr_img($photo, $size, $attribs);
   $title = is_array($photo['title']) ? $photo['title']['_content'] : $photo['title'];
   $photo_url = flickr_photo_page_url($photo['owner'], $photo['id']);
@@ -327,19 +390,28 @@ function theme_flickr_photo_box($variables) {
   return $output;
 }
 
+/**
+ * Theme Flickr photos.
+ */
 function theme_flickr_photos($variables) {
   $photos = $variables['photos'];
-  
+
   $output = theme('pager');
   $output .= "<div class='flickr-photoset'>\n";
   foreach ($photos['photo'] as $photo) {
-    $output .= theme('flickr_photo_box', array('photo' => $photo, 'size' => 'm'));
+    $output .= theme('flickr_photo_box', array(
+      'photo' => $photo,
+      'size' => 'm',
+    ));
   }
   $output .= '</div>';
   $output .= theme('pager');
   return $output;
 }
 
+/**
+ * Theme Flickr photoset.
+ */
 function theme_flickr_photoset($variables) {
   $photoset = $variables['photoset'];
   $owner = $variables['owner'];
@@ -350,19 +422,28 @@ function theme_flickr_photoset($variables) {
     $output = "<div class='flickr-photoset'>\n";
     $photos = flickr_set_load($photoset['id']);
     foreach ((array) $photos['photoset']['photo'] as $photo) {
-      //insert owner into $photo because theme_flickr_photo needs it
+      // Insert owner into $photo because theme_flickr_photo needs it.
       $photo['owner'] = $owner;
-      $output .= theme('flickr_photo', array('photo' => $photo, 'size' => $size));
+      $output .= theme('flickr_photo', array(
+        'photo' => $photo,
+        'size' => $size,
+        ));
     }
     $output .= '</div>';
     return $output;
-  } 
+  }
   else {
-    $img = flickr_img($photoset, $size, $attribs);    
+    $img = flickr_img($photoset, $size, $attribs);
     $output = theme('pager');
-    $photo_url = flickr_photoset_page_url($owner, $photoset['id']);    
+    $photo_url = flickr_photoset_page_url($owner, $photoset['id']);
     $output .= "<div class='flickr-photoset'>\n";
-    $title = is_array($photoset['title']) ? $photoset['title']['_content'] : $photoset['title'];   
-    return l($img, $photo_url, array('attributes' => array('title' => $title), 'absolute' => TRUE, 'html' => TRUE));
+    $title = is_array($photoset['title']) ? $photoset['title']['_content'] : $photoset['title'];
+    return l($img, $photo_url, array(
+      'attributes' => array(
+        'title' => $title),
+      'absolute' => TRUE,
+      'html' => TRUE,
+      ));
   }
-}
\ No newline at end of file
+}
+
diff --git a/sets/flickr_sets.info b/sets/flickr_sets.info
index ab42a88..5685f22 100644
--- a/sets/flickr_sets.info
+++ b/sets/flickr_sets.info
@@ -1,7 +1,7 @@
 name = Flickr Sets
 description = Adds photoset capability to the Flickr module.
-dependencies[] = flickr
-package = Flickr
 core = 7.x
+package = Flickr
+
+dependencies[] = flickr
 
-files[] = flickr_sets.module
\ No newline at end of file
diff --git a/sets/flickr_sets.module b/sets/flickr_sets.module
index b431a34..133177e 100644
--- a/sets/flickr_sets.module
+++ b/sets/flickr_sets.module
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ * The Flickr sets module.
+ */
 
 require_once(drupal_get_path('module', 'flickr') . '/flickr.inc');
 
@@ -29,9 +33,12 @@ function flickr_sets_menu() {
   return $items;
 }
 
+/**
+ * Get the list of photos in a set.
+ */
 function flickr_set_load($sid, $page = 1) {
-  // TODO: Not sure why this called for /flickr and does not show for admin role
-  if (is_numeric($sid)) { 
+  // TODO: Why this called for /flickr and does not show for admin role?
+  if (is_numeric($sid)) {
     return flickr_request('flickr.photosets.getPhotos',
       array(
         'photoset_id' => $sid,
@@ -42,10 +49,16 @@ function flickr_set_load($sid, $page = 1) {
   }
 }
 
+/**
+ * Set a user's photosets page title.
+ */
 function flickr_sets_page_title($user) {
   return 'Flickr photosets - ' . $user->name;
 }
 
+/**
+ * Return a user's photosets (one thumb per set).
+ */
 function flickr_sets_photosets($account, $nsid = NULL) {
   global $pager_page_array, $pager_total, $pager_total_items, $user;
 
@@ -54,14 +67,14 @@ function flickr_sets_photosets($account, $nsid = NULL) {
 
   $uid = $account->uid;
   $nsid = $account->flickr['nsid'];
-  //set this to something else if you want multiple pagers
+  // Set this to something else if you want multiple pagers.
   $element = 0;
   $pager_page_array[$element] = empty($_GET['page']) ? 0 : (int) $_GET['page'];
 
   $set_response = flickr_photoset_get_list($nsid);
 
   if ($set_response === FALSE) {
-    drupal_set_message(t('Error retrieving %user\'s photosets from Flickr', array('%user' => $account->name)));
+    drupal_set_message(t("Error retrieving %user's photosets from Flickr", array('%user' => $account->name)));
     return '';
   }
   if (!$set_response || empty($set_response)) {
@@ -69,13 +82,20 @@ function flickr_sets_photosets($account, $nsid = NULL) {
     return '';
   }
 
-  //set pager information we just acquired
-  $pager_total[$element] = ceil(count($set_response)/variable_get('flickr_photosets_per_page', 20));
+  // Set pager information we just acquired.
+  $pager_total[$element] = ceil(count($set_response) / variable_get('flickr_photosets_per_page', 20));
   $pager_total_items[$element] = count($set_response);
 
-  return theme('flickr_sets_photosets', array('uid' => $uid, 'nsid' => $nsid, 'photosets' => $set_response));
+  return theme('flickr_sets_photosets', array(
+    'uid' => $uid,
+    'nsid' => $nsid,
+    'photosets' => $set_response,
+  ));
 }
 
+/**
+ * Return a user's photos from a given set.
+ */
 function flickr_sets_photoset($account, $set) {
   global $pager_page_array, $pager_total, $pager_total_items, $user;
 
@@ -87,22 +107,22 @@ function flickr_sets_photoset($account, $set) {
   $set_id = $set['photoset']['id'];
   $set_info = flickr_photoset_get_info($set_id);
 
-  //make sure that $nsid is the real owner of $set_id
+  // Make sure that $nsid is the real owner of $set_id.
   if ($nsid != $set_info['owner']) {
     drupal_goto('flickr/' . $uid . '/sets');
   }
 
-  //display photos
-  //set this to something else if you want multiple pagers
+  // Display photos.
+  // Set this to something else if you want multiple pagers.
   $element = 0;
   $pager_page_array[$element] = empty($_GET['page']) ? 0 : (int) $_GET['page'];
   $per_page = variable_get('flickr_photos_per_page', 20);
 
-  //request set photos
+  // Request set of photos.
   $set_response = flickr_set_load($set_id, $pager_page_array[$element] + 1);
 
   if (!$set_response) {
-    drupal_set_message(t('Error retrieving :setid\'s photosets from Flickr'), array(':setid', $set_id));
+    drupal_set_message(t("Error retrieving :setid's photosets from Flickr"), array(':setid', $set_id));
     return '';
   }
   elseif (!isset($set_response['photoset']['photo']) || empty($set_response['photoset']['photo'])) {
@@ -110,15 +130,20 @@ function flickr_sets_photoset($account, $set) {
     return '';
   }
 
-  //set pager information we just acquired
+  // Set pager information we just acquired.
   $pager_total_items[$element] = $set_response['photoset']['total'];
   $pager_total[$element] = $set_response['photoset']['pages'];
 
-  return theme('flickr_sets_photoset', array('uid' => $uid, 'per_page' => $per_page, 'photo_arr' => $set_response, 'set_info' => $set_info));
+  return theme('flickr_sets_photoset', array(
+    'uid' => $uid,
+    'per_page' => $per_page,
+    'photo_arr' => $set_response,
+    'set_info' => $set_info,
+  ));
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function flickr_sets_theme() {
   return array(
@@ -129,11 +154,18 @@ function flickr_sets_theme() {
       'variables' => array('uid', 'per_page', 'photo_arr', 'set_info'),
     ),
     'flickr_sets_photoset_box' => array(
-      'variables' => array('uid', 'photoset', 'size' => 'NULL', 'format' => NULL),
+      'variables' => array(
+        'uid', 'photoset',
+        'size' => 'NULL',
+        'format' => NULL,
+      ),
     ),
   );
 }
 
+/**
+ * Theme a user's photosets (one thumb per set).
+ */
 function theme_flickr_sets_photosets($variables) {
   $uid = $variables['uid'];
   $nsid = $variables['nsid'];
@@ -142,38 +174,53 @@ function theme_flickr_sets_photosets($variables) {
   $output = theme('pager', array('quantity' => variable_get('flickr_photosets_per_page', 20)));
   $output .= "<div class='flickr-photosets'>\n";
   foreach ((array) $photosets as $photoset) {
-    $output .= theme('flickr_sets_photoset_box', array('photoset' => $photoset, 'uid' => $uid, 'nsid' => $nsid, 'size' => 's'));
+    $output .= theme('flickr_sets_photoset_box', array(
+      'photoset' => $photoset,
+      'uid' => $uid,
+      'nsid' => $nsid,
+      'size' => 's',
+    ));
   }
   $output .= '</div>';
   $output .= theme('pager', array('quantity' => variable_get('flickr_photosets_per_page', 20)));
   return $output;
 }
 
+/**
+ * Theme photos in a given set.
+ */
 function theme_flickr_sets_photoset($variables) {
   $uid = $variables['uid'];
   $per_page = $variables['per_page'];
   $photo_arr = $variables['photo_arr'];
   $set_info = $variables['set_info'];
-  
+
   $output = theme('pager', array('quantity' => variable_get('flickr_photos_per_page', 20)));
   $output .= "<div class='flickr-photoset'>\n";
   foreach ((array) $photo_arr['photoset']['photo'] as $photo) {
-    //insert owner into $photo because theme_flickr_photo_box/flickr_photo_page_url needs it
+    // Insert owner into $photo because
+    // theme_flickr_photo_box/flickr_photo_page_url needs it.
     $photo['owner'] = $set_info['owner'];
-    $output .= theme('flickr_photo_box', array('photo' => $photo, 'size' => 'm'));
+    $output .= theme('flickr_photo_box', array(
+      'photo' => $photo,
+      'size' => 'm',
+    ));
   }
   $output .= '</div>';
   $output .= theme('pager', array('quantity' => variable_get('flickr_photos_per_page', 20)));
-  
-  return $output; 
+
+  return $output;
 }
 
+/**
+ * Theme a user's photos in a given set.
+ */
 function theme_flickr_sets_photoset_box($variables) {
   $uid = $variables['uid'];
   $photoset = $variables['photoset'];
   $size = $variables['size'];
   $format = $variables['format'];
-   
+
   $title = is_array($photoset['title']) ? $photoset['title']['_content'] : $photoset['title'];
 
   $output = "<div class='flickr-photoset-box'>\n";
@@ -184,3 +231,4 @@ function theme_flickr_sets_photoset_box($variables) {
 
   return $output;
 }
+
diff --git a/tags/flickr_tags.info b/tags/flickr_tags.info
index 91ccdfc..a1b1b7a 100644
--- a/tags/flickr_tags.info
+++ b/tags/flickr_tags.info
@@ -1,7 +1,7 @@
 name = Flickr Tags
 description = Adds tags capability to Flickr module.
-dependencies[] = flickr
-package = Flickr
 core = 7.x
+package = Flickr
+
+dependencies[] = flickr
 
-files[] = flickr_tag.module
\ No newline at end of file
diff --git a/tags/flickr_tags.module b/tags/flickr_tags.module
index 87bd041..1af0598 100644
--- a/tags/flickr_tags.module
+++ b/tags/flickr_tags.module
@@ -1,9 +1,13 @@
 <?php
+/**
+ * @file
+ * The Flickr tags module.
+ */
 
 require_once(drupal_get_path('module', 'flickr') . '/flickr.inc');
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function flickr_tags_menu() {
   $items['flickr/%user/tags/%'] = array(
@@ -18,7 +22,7 @@ function flickr_tags_menu() {
   $items['flickr/%user/tags/cloud'] = array(
     'title' => 'Cloud',
     'description' => 'Flickr main tag cloud page',
-    'type' => MENU_DEFAULT_LOCAL_TASK, 
+    'type' => MENU_DEFAULT_LOCAL_TASK,
     'page callback' => 'flickr_tags_list',
     'page arguments' => array(1),
     'access callback' => 'flickr_photos_access',
@@ -27,7 +31,7 @@ function flickr_tags_menu() {
   $items['flickr/%user/tags/list'] = array(
     'title' => 'List',
     'description' => 'Flickr tag list page',
-    'type' => MENU_LOCAL_TASK, 
+    'type' => MENU_LOCAL_TASK,
     'page callback' => 'flickr_tags_list',
     'page arguments' => array(1),
     'access callback' => 'flickr_photos_access',
@@ -46,88 +50,115 @@ function flickr_tags_menu() {
   return $items;
 }
 
+/**
+ * Returns a given user's tags cloud.
+ */
 function flickr_tags_cloud($account, $nsid = NULL) {
   drupal_add_css(drupal_get_path('module', 'flickr_tags') . '/flickr_tags.css');
   drupal_set_title(t('Flickr tags cloud - @name', array('@name' => $account->name)));
   $nsid = $account->flickr['nsid'];
-  //get tag info
+  // Get tag info.
   $poptag_response = flickr_tags_get_list_user_popular($nsid, variable_get('flickr_tags_in_cloud', 150));
-  
+
   if ($poptag_response === FALSE) {
-    drupal_set_message(t('Error retrieving %user\'s tags from Flickr', array('%user' => $account->name)));
+    drupal_set_message(t("Error retrieving %user's tags from Flickr", array('%user' => $account->name)));
     return '';
   }
   elseif (empty($poptag_response)) {
     drupal_set_message(t('%user has no tags', array('%user' => $account->name)));
     return '';
   }
-  
+
   $tags = array();
   foreach ($poptag_response as $tag) {
     $tags[$tag['_content']] = $tag['count'];
   }
 
-  return theme('flickr_tags_cloud', array('uid' => $account->uid, 'nsid' => $nsid, 'tags' => $tags));
+  return theme('flickr_tags_cloud', array(
+    'uid' => $account->uid,
+    'nsid' => $nsid,
+    'tags' => $tags,
+  ));
 }
 
+/**
+ * Returns a given user's tags.
+ */
 function flickr_tags_list($account, $nsid = NULL) {
   drupal_add_css(drupal_get_path('module', 'flickr_tags') . '/flickr_tags.css');
   drupal_set_title(t('Flickr tags list - @name', array('@name' => $account->name)));
   $nsid = $account->flickr['nsid'];
-  //get all tags
+  // Get all tags.
   $taglist_response = flickr_tags_get_list_user($nsid);
-  
+
   if ($taglist_response === FALSE) {
-    drupal_set_message(t('Error retrieving %user\'s tags from Flickr', array('%user' => $account->name)));
+    drupal_set_message(t("Error retrieving %user's tags from Flickr", array('%user' => $account->name)));
     return '';
   }
   elseif (empty($taglist_response)) {
     drupal_set_message(t('%user has no tags', array('%user' => $account->name)));
     return '';
   }
-  
+
   $tags = array();
   foreach ($taglist_response as $tag) {
     $tags[] = $tag['_content'];
   }
-  
-  //pass array to the theme function
-  return theme('flickr_tags_list', array('uid' => $account->uid, 'nsid' => $nsid, 'tags' => $tags));
+
+  // Pass array to the theme function.
+  return theme('flickr_tags_list', array(
+    'uid' => $account->uid,
+    'nsid' => $nsid,
+    'tags' => $tags,
+  ));
 }
 
+/**
+ * Returns a user's photos with given tags.
+ */
 function flickr_tags_photos($account, $tagstring) {
   global $pager_page_array, $pager_total, $pager_total_items;
 
   drupal_add_css(drupal_get_path('module', 'flickr') . '/flickr.css');
-  drupal_set_title(t('Flickr photos of @user tagged @tag', array('@user' => $account->name, '@tag' => $tagstring)));
+  drupal_set_title(t('Flickr photos of @user tagged @tag', array(
+    '@user' => $account->name,
+    '@tag' => $tagstring,
+  )));
 
   $tags = explode(',', $tagstring);
   $nsid = $account->flickr['nsid'];
-  
-  //set this to something else if you want multiple pagers
+
+  // Set this to something else if you want multiple pagers.
   $element = 0;
   $pager_page_array[$element] = empty($_GET['page']) ? 0 : (int) $_GET['page'];
 
   $photo_arr = flickr_photos_search($nsid, $pager_page_array[$element] + 1, flickr_tag_request_args($tags));
 
   if ($photo_arr === FALSE) {
-    drupal_set_message(t('Error retrieving %user\'s photos from Flickr', array('%user' => $account->name)));
+    drupal_set_message(t("Error retrieving %user's photos from Flickr", array('%user' => $account->name)));
     return '';
   }
   elseif (empty($photo_arr)) {
-    drupal_set_message(t('No photos tagged with %tags found in %user\'s Flickr account', array('%user' => $account->name, '%tags' => str_replace(',', ', ', $tagstring))));
+    drupal_set_message(t("No photos tagged with %tags found in %user's Flickr account", array(
+      '%user' => $account->name,
+      '%tags' => str_replace(',', ', ', $tagstring),
+    )));
     return '';
   }
-  
-  //set pager information we just acquired
+
+  // Set pager information we just acquired.
   $pager_total[$element] = $photo_arr['pages'];
   $pager_total_items[$element] = $photo_arr['total'];
-  
-  return theme('flickr_photos', array('uid' => $account->uid, 'nsid' => $nsid, 'photos' => $photo_arr));
+
+  return theme('flickr_photos', array(
+    'uid' => $account->uid,
+    'nsid' => $nsid,
+    'photos' => $photo_arr,
+  ));
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function flickr_tags_theme() {
   return array(
@@ -140,11 +171,14 @@ function flickr_tags_theme() {
   );
 }
 
+/**
+ * Theme Flickr tags list.
+ */
 function theme_flickr_tags_list($variables) {
   $uid = $variables['uid'];
-  $nsid = $variables['nsid']; 
+  $nsid = $variables['nsid'];
   $tags = $variables['tags'];
-  
+
   $output = "<ul id='flickr_taglist'>\n";
   $first_char = '';
   foreach ($tags as $tag) {
@@ -154,50 +188,54 @@ function theme_flickr_tags_list($variables) {
     else {
       $new_item = FALSE;
     }
-    
-    if ($first_char!='' && $new_item) {
+
+    if ($first_char != '' && $new_item) {
       $output .= "</ul></li>\n";
     }
     if ($new_item) {
       $first_char = substr($tag, 0, 1);
       $output .= "<li><ul>\n";
     }
-    
+
     $output .= "<li>";
     $output .= l($tag, "flickr/$uid/tag/$tag");
     $output .= "</li>\n";
   }
-  if ($first_char!='') {
+  if ($first_char != '') {
     $output .= "</ul></li>\n";
   }
   $output .= "</ul>\n";
-  
+
   return $output; '';
 }
 
+/**
+ * Theme Flickr tags cloud.
+ */
 function theme_flickr_tags_cloud($variables) {
   $uid = $variables['uid'];
-  $nsid = $variables['nsid']; 
+  $nsid = $variables['nsid'];
   $tags = $variables['tags'];
-  
+
   $max_occur = max($tags);
   $min_occur = min($tags);
-  
-  // Font size specified in em
+
+  // Font size specified in em.
   $max_font = 3.5;
   $min_font = 0.7;
-  
+
   $output = "<ul id='flickr_tagcloud'>\n";
   foreach ($tags as $tagname => $occurences) {
-    
-    $font_size = round(($max_font-$min_font) * sqrt($occurences/$max_occur) + $min_font, 1);
-    
+
+    $font_size = round(($max_font - $min_font) * sqrt($occurences / $max_occur) + $min_font, 1);
+
     $output .= "<li style='font-size: {$font_size}em'>";
     $output .= l($tagname, "flickr/$uid/tags/$tagname");
     $output .= "</li>\n";
-    
+
   }
   $output .= "</ul>\n";
-  
+
   return $output;
-}
\ No newline at end of file
+}
+
