diff --git a/flickr.inc b/flickr.inc
index 9b70a9b..2e9a52f 100644
--- a/flickr.inc
+++ b/flickr.inc
@@ -161,7 +161,8 @@ function flickr_img($photo, $size = NULL, $attributes = NULL) {
   $info = !is_array($photo['title']) ? flickr_photo_get_info($photo['id']) : '';
   $title = is_array($photo['title']) ? str_replace('"', "'", htmlspecialchars_decode(strip_tags($photo['description']['_content']))) : str_replace('"', "'", htmlspecialchars_decode(strip_tags($info['description']['_content'])));
   if (empty($title) == 'title') {
-    $title = $photo['title'];
+  // Make sure we are not passing an array where a string is expected.
+  $title = is_array($photo['title']) ? str_replace('"', "'", htmlspecialchars_decode(strip_tags($photo['title']['_content']))) : $photo['title'];
   }
   return theme('image', $img_url, $title, $title, $attributes, FALSE);
 }
diff --git a/sets/flickr_sets.module b/sets/flickr_sets.module
index e6febe9..350d639 100644
--- a/sets/flickr_sets.module
+++ b/sets/flickr_sets.module
@@ -1,9 +1,9 @@
 <?php
 
-require_once(drupal_get_path('module', 'flickr') .'/flickr.inc');
+require_once(drupal_get_path('module', 'flickr') . '/flickr.inc');
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function flickr_sets_menu() {
   $items['flickr/%user/sets'] = array(
@@ -30,7 +30,8 @@ function flickr_sets_menu() {
 }
 
 function flickr_set_load($sid, $page = 1) {
-  // TODO: Not sure why this called for /flickr and does not show for admin role
+  // TODO: Not sure why this called for /flickr and does not show for admin
+  // role.
   if (is_numeric($sid)) {
     return flickr_request('flickr.photosets.getPhotos',
     array(
@@ -45,12 +46,12 @@ function flickr_set_load($sid, $page = 1) {
 function flickr_sets_photosets($account, $nsid = NULL) {
   global $pager_page_array, $pager_total, $pager_total_items, $user;
   if (variable_get('flickr_css', 1)) {
-    drupal_add_css(drupal_get_path('module', 'flickr') .'/flickr.css');
+    drupal_add_css(drupal_get_path('module', 'flickr') . '/flickr.css');
   }
 
   $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'];
   $per_page = variable_get('flickr_photos_per_page', 20);
@@ -62,11 +63,11 @@ function flickr_sets_photosets($account, $nsid = NULL) {
     return '';
   }
   if (!$set_response || empty($set_response)) {
-      drupal_set_message(t('%user has no photosets.', array('%user' => $account->name)));
+    drupal_set_message(t('%user has no photosets.', array('%user' => $account->name)));
     return '';
   }
 
-  //set pager information we just acquired
+  // Set pager information we just acquired.
   $pager_total[$element] = $set_response['pages'];
   $pager_total_items[$element] = $set_response['total'];
   return theme('flickr_sets_photosets', $uid, $per_page, $nsid, $set_response['photoset']);
@@ -76,7 +77,7 @@ function flickr_sets_photoset($account, $set) {
   global $pager_page_array, $pager_total, $pager_total_items, $user;
 
   if (variable_get('flickr_css', 1)) {
-    drupal_add_css(drupal_get_path('module', 'flickr') .'/flickr.css');
+    drupal_add_css(drupal_get_path('module', 'flickr') . '/flickr.css');
   }
 
   $uid = $user->uid;
@@ -85,18 +86,18 @@ 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');
+    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 photos.
   $set_response = flickr_set_load($set_id, $pager_page_array[$element] + 1);
 
   if (!$set_response) {
@@ -104,11 +105,11 @@ function flickr_sets_photoset($account, $set) {
     return '';
   }
   elseif (!isset($set_response['photoset']['photo']) || empty($set_response['photoset']['photo'])) {
-      drupal_set_message('This photoset is empty');
-      return '';
+    drupal_set_message('This photoset is empty');
+    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'];
 
@@ -116,7 +117,7 @@ function flickr_sets_photoset($account, $set) {
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function flickr_sets_theme() {
   return array(
@@ -127,7 +128,13 @@ function flickr_sets_theme() {
       'arguments' => array('uid', 'per_page', 'photo_arr', 'set_info'),
     ),
     'flickr_sets_photoset_box' => array(
-      'arguments' => array('ps', 'uid', 'owner', 'size' => 'NULL', 'format' => NULL),
+      'arguments' => array(
+        'ps',
+        'uid',
+        'owner',
+        'size' => 'NULL',
+        'format' => NULL,
+      ),
     ),
   );
 }
@@ -144,11 +151,11 @@ function theme_flickr_sets_photosets($uid, $per_page, $nsid, $photosets) {
 }
 
 function theme_flickr_sets_photoset($uid, $per_page, $photo_arr, $set_info) {
-  $output =
-    theme('pager', NULL, variable_get('flickr_photos_per_page', 20));
+  $output = theme('pager', NULL, variable_get('flickr_photos_per_page', 20));
   $output .= "<div class='fickr-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', $photo, 'm');
   }
@@ -161,11 +168,11 @@ function theme_flickr_sets_photoset($uid, $per_page, $photo_arr, $set_info) {
 function theme_flickr_sets_photoset_box($ps, $uid, $owner, $size = NULL, $format = NULL) {
   $title = is_array($ps['title']) ? $ps['title']['_content'] : $ps['title'];
 
-  $output = "<div class='flickr-photoset-box'>\n";
-  $output .= l(flickr_img($ps, $size) ."\n", "flickr/{$uid}/sets/{$ps['id']}", array('html' => TRUE));
-  $output .= l('<div class="flickr-photoset-title">'. $title ."</div>\n", "flickr/{$uid}/sets/{$ps['id']}", array('html' => TRUE));
-  $output .= '<div class="flickr-photoset-count">'. format_plural($ps['photos'], '@count photo', '@count photos') ."</div>\n";
-  $output .= "</div>\n";
+  $output = "<div class='flickr-photoset-box'>";
+  $output .= l(flickr_img($ps, $size), "flickr/{$uid}/sets/{$ps['id']}", array('html' => TRUE));
+  $output .= '<div class="flickr-photoset-title">' . l($title, "flickr/{$uid}/sets/{$ps['id']}") . '</div>';
+  $output .= '<div class="flickr-photoset-count">' . format_plural($ps['photos'], '1 photo', '@count photos') . '</div>';
+  $output .= "</div>";
 
   return $output;
 }
