diff --git a/fivestar.module b/fivestar.module
index 0125842..c47bc22 100644
--- a/fivestar.module
+++ b/fivestar.module
@@ -225,7 +225,7 @@ function fivestar_get_votes_multiple($entity_type, $ids, $tag = 'vote', $uid = N
   $votes = array();
 
   // Initialize defaults.
-  foreach($ids as $id) {
+  foreach ($ids as $id) {
     $votes[$entity_type][$id] = array(
       'average' => array(),
       'count' => array(),
@@ -235,8 +235,8 @@ function fivestar_get_votes_multiple($entity_type, $ids, $tag = 'vote', $uid = N
 
   $results = votingapi_select_results($criteria);
   $user_votes = array();
-  if(!empty($results)) {
-    foreach(votingapi_select_votes($criteria += array('uid' => $uid)) as $uv) {
+  if (!empty($results)) {
+    foreach (votingapi_select_votes($criteria += array('uid' => $uid)) as $uv) {
       $user_votes[$uv['entity_type']][$uv['entity_id']] = $uv;
     }
   }
@@ -248,18 +248,18 @@ function fivestar_get_votes_multiple($entity_type, $ids, $tag = 'vote', $uid = N
     if ($result['function'] == 'count') {
       $votes[$result['entity_type']][$result['entity_id']]['count'] = $result;
     }
-	  if ($uid) {
-	    if (!empty($user_votes[$result['entity_type']][$result['entity_id']])) {
+    if ($uid) {
+      if (!empty($user_votes[$result['entity_type']][$result['entity_id']])) {
         $votes[$result['entity_type']][$result['entity_id']]['user'] = $user_votes[$result['entity_type']][$result['entity_id']];
         $votes[$result['entity_type']][$result['entity_id']]['user']['function'] = 'user';
-	    }
-	  }
-	  else {
-	    // If the user is anonymous, we never bother loading their existing votes.
-	    // Not only would it be hit-or-miss, it would break page caching. Safer to always
-	    // show the 'fresh' version to anon users.
+      }
+    }
+    else {
+      // If the user is anonymous, we never bother loading their existing votes.
+      // Not only would it be hit-or-miss, it would break page caching. Safer to always
+      // show the 'fresh' version to anon users.
       $votes[$result['entity_type']][$result['entity_id']]['user'] = array('value' => 0);
-	  }
+    }
   }
 
   return $votes;
@@ -352,7 +352,7 @@ function fivestar_fivestar_access($entity_type, $id, $tag, $uid) {
 function fivestar_form_comment_form_alter(&$form, &$form_state, $form_id) {
   $fivestar_field_keys = array();
   if (isset($form['comment_output_below'])) {
-    foreach($form['comment_output_below'] as $key => $value) {
+    foreach ($form['comment_output_below'] as $key => $value) {
       if (is_array($value) && !empty($value['#field_type']) && $value['#field_type'] == 'fivestar') {
         $fivestar_field_keys[] = $key;
       }
@@ -570,7 +570,7 @@ function fivestar_element_info() {
  * Process callback for fivestar_element -- see fivestar_element()
  */
 function fivestar_expand($element, $form_state, $complete_form) {
-  if (!_fivestar_allow_vote($element)){
+  if (!_fivestar_allow_vote($element)) {
     $element['#input'] = FALSE;
   }
 
@@ -590,7 +590,8 @@ function fivestar_expand($element, $form_state, $complete_form) {
     if (isset($entity->title)) {
       $title = $entity->title;
     }
-  } elseif (isset($complete_form['#node'])) {
+  }
+  elseif (isset($complete_form['#node'])) {
     $title = $complete_form['#node']->title;
   }
   $options = array('-' => t('Select rating'));
diff --git a/includes/fivestar.field.inc b/includes/fivestar.field.inc
index 053d5a1..95eb99f 100644
--- a/includes/fivestar.field.inc
+++ b/includes/fivestar.field.inc
@@ -286,10 +286,10 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
     }
     $element['rating'] = array(
       '#type' => 'select',
-      '#title' => isset($instance['label']) ? (($i18n) ? i18n_field_translate_property($instance, 'label') : t($instance['label'])) : FALSE,
+      '#title' => check_plain(isset($instance['label']) ? (($i18n) ? i18n_field_translate_property($instance, 'label') : t($instance['label'])) : FALSE),
       '#options' => $options,
       '#default_value' => isset($items[$delta]['rating']) ? $items[$delta]['rating'] : NULL,
-      '#description' => isset($instance['description']) ? (($i18n) ? i18n_field_translate_property($instance, 'description') : t($instance['description'])) : FALSE,
+      '#description' => check_plain(isset($instance['description']) ? (($i18n) ? i18n_field_translate_property($instance, 'description') : t($instance['description'])) : FALSE),
       '#required' => isset($instance['required']) ? $instance['required'] : FALSE,
     );
   }
@@ -319,8 +319,8 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
     );
 
     $element['rating'] = array(
-      '#type'=> 'fivestar',
-      '#title' => isset($instance['label']) ? (($i18n) ? i18n_field_translate_property($instance, 'label') : t($instance['label'])) : FALSE,
+      '#type' => 'fivestar',
+      '#title' => check_plain(isset($instance['label']) ? (($i18n) ? i18n_field_translate_property($instance, 'label') : t($instance['label'])) : FALSE),
       '#stars' => isset($instance['settings']['stars']) ? $instance['settings']['stars'] : 5,
       '#allow_clear' => isset($instance['settings']['allow_clear']) ? $instance['settings']['allow_clear'] : FALSE,
       '#allow_revote' => isset($instance['settings']['allow_revote']) ? $instance['settings']['allow_revote'] : FALSE,
@@ -329,7 +329,7 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
       '#widget' => $widget,
       '#settings' => $settings,
       '#values' => $values,
-      '#description' => isset($instance['description']) ? (($i18n) ? i18n_field_translate_property($instance, 'description') : t($instance['description'])) : FALSE,
+      '#description' => check_plain(isset($instance['description']) ? (($i18n) ? i18n_field_translate_property($instance, 'description') : t($instance['description'])) : FALSE),
       '#required' => isset($instance['required']) ? $instance['required'] : FALSE,
     );
   }
@@ -735,9 +735,9 @@ function fivestar_field_prepare_view($entity_type, $entities, $field, $instances
         $items[$id] = array($values);
       }
     }
-    if(!empty($exposed_widgets)) {
+    if (!empty($exposed_widgets)) {
       $votes = fivestar_get_votes_multiple($entity_type, $exposed_widgets, $field['settings']['axis']);
-      foreach($votes[$entity_type] as $id => $vote) {
+      foreach ($votes[$entity_type] as $id => $vote) {
         // Populating the $items[$id] array even for items with no value forces
         // the render system to output a widget.
         $values['user'] = isset($vote['user']['value']) ? $vote['user']['value'] : 0;
diff --git a/includes/fivestar.theme.inc b/includes/fivestar.theme.inc
index 6464a54..72b747f 100644
--- a/includes/fivestar.theme.inc
+++ b/includes/fivestar.theme.inc
@@ -281,7 +281,7 @@ function theme_fivestar_summary($variables) {
       $div_class = 'count';
     }
     if ($votes === 0) {
-      $output = '<span class="empty">'. t('No votes yet') .'</span>';
+      $output = '<span class="empty">' . t('No votes yet') . '</span>';
     }
     else {
       if (!empty($microdata['rating_count']['#attributes'])) {
