diff --git a/fivestar.api.php b/fivestar.api.php
index a9f0e2a..c9efcb4 100644
--- a/fivestar.api.php
+++ b/fivestar.api.php
@@ -11,11 +11,6 @@
  * This hook allows other modules to create additional custom widgets for
  * the fivestar module.
  *
- * @return array
- *   An array of key => value pairs suitable for inclusion as the #options in a
- *   select or radios form element. Each key must be the location of a css
- *   file for a fivestar widget. Each value should be the name of the widget.
- *
  * @see fivestar_fivestar_widgets()
  */
 function hook_fivestar_widgets() {
@@ -35,22 +30,6 @@ function hook_fivestar_widgets() {
  * modules to allow or deny voting on any type of entity, such as nodes, users,
  * or comments.
  *
- * @param $entity_type
- *   Type entity.
- * @param $id
- *   Identifier within the type.
- * @param $tag
- *   The VotingAPI tag string.
- * @param $uid
- *   The user ID trying to cast the vote.
- *
- * @return bool|null
- *   Returns TRUE if voting is supported on this object.
- *   Returns NULL if voting is not supported on this object by this module.
- *   If needing to absolutely deny all voting on this object, regardless
- *   of permissions defined in other modules, return FALSE. Note if all
- *   modules return NULL, stating no preference, then access will be denied.
- *
  * @see fivestar_validate_target()
  * @see fivestar_fivestar_access()
  */
@@ -64,29 +43,16 @@ function hook_fivestar_access($entity_type, $id, $tag, $uid) {
 /**
  * Implements hook_fivestar_target_info().
  *
- * @param $field
- *   The field structure for the operation.
- * @param $instance
- *   The instance structures for the $field.
- *
- * @return array
- *   An array of key => value pairs. Each key must be unique the identifier for
- *   this target selection. The Value is an array of key => value pairs for a
- *   title and a callback function. The title value is used for displaying in
- *   the #options array of the target selection option. The callback function
- *   is used when trying to decided which target the current vote should be
- *   cast against.
- *
  * @see fivestar_get_targets()
  * @see fivestar_fivestar_target_info()
  */
 function hook_fivestar_target_info($field, $instance) {
-  $entity_type = $instance['entity_type'];
-  $bundle = $instance['bundle'];
-
+  // $entity_type = $instance['entity_type'];
+  // $bundle = $instance['bundle'];
   $options = array(
     // Declase a new Target Type.
-    // This will allow users to vote on a Node and have the vote cast against the
+    // This will allow users to vote on a Node and
+    // have the vote cast against the
     // node's author instead of the actual node.
     'example_node_author' => array(
       'title' => t('Node Author'),
@@ -102,13 +68,13 @@ function hook_fivestar_target_info($field, $instance) {
  *
  * Invoked from fivestar_get_targets().
  *
- * @param $entity
+ * @param string $entity
  *   The entity for the operation.
- * @param $field
+ * @param string $field
  *   The field structure for the operation.
- * @param $instance
+ * @param string $instance
  *   The instance structure for $field on $entity's bundle.
- * @param $langcode
+ * @param string $langcode
  *   The language associated with $items.
  *
  * @return array
diff --git a/fivestar.info b/fivestar.info
index 941bfdb..77a5f23 100644
--- a/fivestar.info
+++ b/fivestar.info
@@ -5,6 +5,6 @@ core = 7.x
 dependencies[] = votingapi
 configure = admin/config/content/fivestar
 files[] = fivestar.migrate.inc
-files[] = includes/fivestar_views_handler_filter_in_operator.inc
+files[] = includes/FivestarViewsHandlerFilterInOperator.inc
 files[] = test/fivestar.base.test
 files[] = test/fivestar.field.test
diff --git a/fivestar.install b/fivestar.install
index 6279c04..d71f53e 100644
--- a/fivestar.install
+++ b/fivestar.install
@@ -9,7 +9,9 @@
  * Implements hook_uninstall().
  */
 function fivestar_uninstall() {
-  db_query("DELETE FROM {variable} WHERE name LIKE 'fivestar_%'");
+  db_delete('variable')
+    ->condition('name', 'fivestar_%', 'like')
+    ->execute();
 }
 
 /**
@@ -64,7 +66,9 @@ function fivestar_update_7202() {
 }
 
 /**
- * Converts all existing fivestar/node_type settings into fields with exposed fivestar formatters.
+ * Converts all existing fivestar/node_type settings into fields .
+ *
+ * Along with exposed fivestar formatters.
  */
 function fivestar_update_7203() {
   // Gather the node types.
@@ -176,7 +180,9 @@ function fivestar_update_7203() {
 }
 
 /**
- * Preserve settings from fivestar_formatter_exposed_stars and convert to fivestar_formatter_default.
+ * Preserve settings from fivestar_formatter_exposed_stars .
+ *
+ * And convert to fivestar_formatter_default.
  */
 function fivestar_update_7204() {
   $fields = field_read_fields(array('type' => 'fivestar'));
@@ -186,8 +192,9 @@ function fivestar_update_7204() {
     foreach ($instances as $instance) {
       // The default should be to not allow clearing.
       $instance['settings']['allow_clear'] = FALSE;
-      // Check each of the displays on the field instance an convert the formatter
-      // from fivestar_formatter_exposed_stars to fivestar_formatter_default.
+      // Check each of the displays on the field instance an convert
+      // the formatter from fivestar_formatter_exposed_stars
+      // to fivestar_formatter_default.
       foreach ($instance['display'] as $key => $display) {
         if ($display['type'] == 'fivestar_formatter_exposed_stars') {
           // Convert the formatter and set the exposed settings.
diff --git a/fivestar.migrate.inc b/fivestar.migrate.inc
index fb7342d..bab0a74 100644
--- a/fivestar.migrate.inc
+++ b/fivestar.migrate.inc
@@ -11,7 +11,7 @@
 function fivestar_migrate_api() {
   $api = array(
     'api' => 2,
-    'field handlers' => array('MigrateFivestarFieldHandler'),
+    'field handlers' => array('FivestarMigrateFieldHandler'),
   );
   return $api;
 }
@@ -19,17 +19,17 @@ function fivestar_migrate_api() {
 /**
  * Custom extended MigrateFieldHandler class for FiveStar module.
  */
-class MigrateFivestarFieldHandler extends MigrateFieldHandler {
+class FivestarMigrateFieldHandler extends MigrateFieldHandler {
 
   /**
-   *
+   * {@inheritdoc}
    */
   public function __construct() {
     $this->registerTypes(array('fivestar'));
   }
 
   /**
-   *
+   * {@inheritdoc}
    */
   public function fields($type, $parent_field, $migration = NULL) {
     $fields = array(
@@ -39,7 +39,7 @@ class MigrateFivestarFieldHandler extends MigrateFieldHandler {
   }
 
   /**
-   *
+   * {@inheritdoc}
    */
   public function prepare($entity, array $field_info, array $instance, array $values) {
     $arguments = array();
diff --git a/fivestar.module b/fivestar.module
index a66d511..9458624 100644
--- a/fivestar.module
+++ b/fivestar.module
@@ -111,20 +111,41 @@ function fivestar_theme() {
       'file' => 'includes/fivestar.theme.inc',
     ),
     'fivestar_static' => array(
-      'variables' => array('rating' => NULL, 'stars' => 5, 'tag' => 'vote', 'widget' => array('name' => 'default', 'css' => '')),
+      'variables' => array(
+        'rating' => NULL,
+        'stars' => 5,
+        'tag' => 'vote',
+        'widget' => array('name' => 'default', 'css' => ''),
+      ),
       'file' => 'includes/fivestar.theme.inc',
     ),
     'fivestar_static_element' => array(
-      'variables' => array('star_display' => NULL, 'title' => NULL, 'description' => NULL),
+      'variables' => array(
+        'star_display' => NULL,
+        'title' => NULL,
+        'description' => NULL,
+      ),
       'file' => 'includes/fivestar.theme.inc',
     ),
     'fivestar_summary' => array(
-      'variables' => array('user_rating' => NULL, 'average_rating' => NULL, 'votes' => 0, 'stars' => 5, 'microdata' => array()),
+      'variables' => array(
+        'user_rating' => NULL,
+        'average_rating' => NULL,
+        'votes' => 0,
+        'stars' => 5,
+        'microdata' => array(),
+      ),
       'file' => 'includes/fivestar.theme.inc',
     ),
     // fivestar.admin.inc.
     'fivestar_preview' => array(
-      'variables' => array('style' => NULL, 'text' => NULL, 'stars' => NULL, 'unvote' => NULL, 'title' => NULL),
+      'variables' => array(
+        'style' => NULL,
+        'text' => NULL,
+        'stars' => NULL,
+        'unvote' => NULL,
+        'title' => NULL,
+      ),
       'file' => 'includes/fivestar.theme.inc',
     ),
     'fivestar_preview_widget' => array(
@@ -169,17 +190,34 @@ function fivestar_views_api() {
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function _fivestar_variables() {
-  return array('fivestar', 'fivestar_unvote', 'fivestar_style', 'fivestar_stars', 'fivestar_comment', 'fivestar_position', 'fivestar_position_teaser', 'fivestar_labels_enable', 'fivestar_labels', 'fivestar_text', 'fivestar_title', 'fivestar_feedback');
+  return array('fivestar', 'fivestar_unvote', 'fivestar_style', 'fivestar_stars',
+    'fivestar_comment', 'fivestar_position', 'fivestar_position_teaser',
+    'fivestar_labels_enable', 'fivestar_labels', 'fivestar_text', 'fivestar_title',
+    'fivestar_feedback',
+  );
 }
 
 /**
- * Internal function to handle vote casting, flood control, XSS, IP based
- * voting, etc...
+ * Internal function to handle .
+ *
+ * Vote casting.
+ *
+ * Flood control
+ *
+ * XSS
+ *
+ * IP based voting, etc...
  */
-function _fivestar_cast_vote($entity_type, $id, $value, $tag = NULL, $uid = NULL, $skip_validation = FALSE, $vote_source = NULL) {
+function _fivestar_cast_vote($entity_type,
+ $id,
+ $value,
+ $tag = NULL,
+ $uid = NULL,
+ $skip_validation = FALSE,
+ $vote_source = NULL) {
   global $user;
   $tag = empty($tag) ? 'vote' : $tag;
   $uid = isset($uid) ? $uid : $user->uid;
@@ -194,7 +232,12 @@ function _fivestar_cast_vote($entity_type, $id, $value, $tag = NULL, $uid = NULL
     }
 
     // Get the user's current vote.
-    $criteria = array('entity_type' => $entity_type, 'entity_id' => $id, 'tag' => $tag, 'uid' => $uid);
+    $criteria = array(
+      'entity_type' => $entity_type,
+      'entity_id' => $id,
+      'tag' => $tag,
+      'uid' => $uid,
+    );
     // Get the unique identifier for the user (IP Address if anonymous).
     if ($vote_source != NULL) {
       $user_criteria = array('vote_source' => $vote_source);
@@ -228,16 +271,16 @@ function _fivestar_cast_vote($entity_type, $id, $value, $tag = NULL, $uid = NULL
  * VotingAPI function votingapi_select_results() should be used, which is more
  * efficient when retrieving multiple votes.
  *
- * @param $entity_type
+ * @param string $entity_type
  *   The Entity type for which to retrieve votes.
- * @param $id
+ * @param int $ids
  *   The ID for which to retrieve votes.
- * @param $tag
+ * @param string $tag
  *   The VotingAPI tag for which to retrieve votes.
- * @param $uid
+ * @param string $uid
  *   Optional. A user ID for which to retrieve votes.
  *
- * @return
+ * @return array
  *   An array of the following keys:
  *   - average: An array of VotingAPI results, including the average 'value'.
  *   - count: An array of VotingAPI results, including the count 'value'.
@@ -285,15 +328,19 @@ function fivestar_get_votes_multiple($entity_type, $ids, $tag = 'vote', $uid = N
     }
     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';
+        $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.
-      $votes[$result['entity_type']][$result['entity_id']]['user'] = array('value' => 0);
+      $votes[$result['entity_type']][$result['entity_id']]['user'] = array(
+        'value' => 0,
+      );
     }
   }
 
@@ -301,7 +348,7 @@ function fivestar_get_votes_multiple($entity_type, $ids, $tag = 'vote', $uid = N
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function fivestar_get_votes($entity_type, $id, $tag = 'vote', $uid = NULL) {
   $multiple = fivestar_get_votes_multiple($entity_type, array($id), $tag, $uid);
@@ -311,16 +358,17 @@ function fivestar_get_votes($entity_type, $id, $tag = 'vote', $uid = NULL) {
 /**
  * Check that an item being voted upon is a valid vote.
  *
- * @param $entity_type
+ * @param string $entity_type
  *   Type of target.
- * @param $id
+ * @param int $id
  *   Identifier within the type.
- * @param $tag
+ * @param string $tag
  *   The VotingAPI tag string.
- * @param $uid
+ * @param string $uid
  *   The user trying to cast the vote.
  *
  * @return bool
+ *   Returns bool
  */
 function fivestar_validate_target($entity_type, $id, $tag, $uid = NULL) {
   if (!isset($uid)) {
@@ -344,22 +392,6 @@ function fivestar_validate_target($entity_type, $id, $tag, $uid = NULL) {
  * This hook is called before every vote is cast through Fivestar. It allows
  * modules to allow voting on any type of entity, such as nodes, users, or
  * comments.
- *
- * @param $entity_type
- *   Type entity.
- * @param $id
- *   Identifier within the type.
- * @param $tag
- *   The VotingAPI tag string.
- * @param $uid
- *   The user ID trying to cast the vote.
- *
- * @return bool|NULL
- *   Returns TRUE if voting is supported on this object.
- *   Returns NULL if voting is not supported on this object by this module.
- *   If needing to absolutely deny all voting on this object, regardless
- *   of permissions defined in other modules, return FALSE. Note if all
- *   modules return NULL, stating no preference, then access will be denied.
  */
 function fivestar_fivestar_access($entity_type, $id, $tag, $uid) {
   // Check to see if there is a field instance on this entity.
@@ -391,7 +423,8 @@ 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) {
-      if (is_array($value) && !empty($value['#field_type']) && $value['#field_type'] == 'fivestar') {
+      if (is_array($value) && !empty($value['#field_type']) &&
+      $value['#field_type'] == 'fivestar') {
         $fivestar_field_keys[] = $key;
       }
     }
@@ -408,11 +441,6 @@ function fivestar_form_comment_form_alter(&$form, &$form_state, $form_id) {
  *
  * This hook allows other modules to create additional custom widgets for
  * the fivestar module.
- *
- * @return array
- *   An array of key => value pairs suitable for inclusion as the #options in a
- *   select or radios form element. Each key must be the location of a css
- *   file for a fivestar widget. Each value should be the name of the widget.
  */
 function fivestar_fivestar_widgets() {
   $widgets = &drupal_static(__FUNCTION__);
@@ -443,15 +471,15 @@ function fivestar_fivestar_widgets() {
  * drupal_get_form('fivestar_custom_widget', $values, $settings) when wanting
  * to display a widget.
  *
- * @param $form_state
+ * @param array $form_state
  *   The form state provided by Form API.
- * @param $values
+ * @param array $values
  *   An array of current vote values from 0 to 100, with the following array
  *   keys:
  *   - user: The user's current vote.
  *   - average: The average vote value.
  *   - count: The total number of votes so far on this content.
- * @param $settings
+ * @param array $settings
  *   An array of settings that configure the properties of the rating widget.
  *   Available keys for the settings include:
  *   - content_type: The type of content which will be voted upon.
@@ -467,7 +495,7 @@ function fivestar_fivestar_widgets() {
  *   - tag: The VotingAPI tag that will be registered by this widget. Defaults
  *     to "vote".
  */
-function fivestar_custom_widget($form, &$form_state, $values, $settings) {
+function fivestar_custom_widget($form, array &$form_state, array $values, array $settings) {
   $form = array(
     '#attributes' => array(
       'class' => array('fivestar-widget'),
@@ -526,7 +554,8 @@ function fivestar_custom_widget($form, &$form_state, $values, $settings) {
 function fivestar_form_submit($form, &$form_state) {
 
   // Cast the vote.
-  _fivestar_cast_vote($form_state['settings']['content_type'], $form_state['settings']['content_id'], $form_state['values']['vote'], $form_state['settings']['tag']);
+  _fivestar_cast_vote($form_state['settings']['content_type'],
+  $form_state['settings']['content_id'], $form_state['values']['vote'], $form_state['settings']['tag']);
 
   // Set a message that the vote was received.
   if ($form_state['values']['vote'] === '0') {
@@ -542,10 +571,15 @@ function fivestar_form_submit($form, &$form_state) {
  */
 function fivestar_ajax_submit($form, $form_state) {
   if (!empty($form_state['settings']['content_id'])) {
-    $entity = entity_load($form_state['settings']['entity_type'], array($form_state['settings']['entity_id']));
+    $entity = entity_load($form_state['settings']['entity_type'],
+     array($form_state['settings']['entity_id']));
     $entity = reset($entity);
-    _fivestar_update_field_value($form_state['settings']['content_type'], $entity, $form_state['settings']['field_name'], $form_state['settings']['langcode'], $form_state['values']['vote']);
-    $votes = _fivestar_cast_vote($form_state['settings']['entity_type'], $form_state['settings']['content_id'], $form_state['values']['vote'], $form_state['settings']['tag']);
+    _fivestar_update_field_value($form_state['settings']['content_type'],
+     $entity, $form_state['settings']['field_name'],
+     $form_state['settings']['langcode'], $form_state['values']['vote']);
+    $votes = _fivestar_cast_vote($form_state['settings']['entity_type'],
+    $form_state['settings']['content_id'], $form_state['values']['vote'],
+    $form_state['settings']['tag']);
   }
 
   $values = array();
@@ -557,10 +591,12 @@ function fivestar_ajax_submit($form, $form_state) {
   $form['vote']['#values'] = $values;
   // Also need to pass on form_state and the complete form,
   // just like form_builder() does.
-  $new_element = fivestar_expand($form['vote'], $form_state, $form_state['complete form']);
+  $new_element = fivestar_expand($form['vote'], $form_state,
+  $form_state['complete form']);
   // Update the description. Since it doesn't account of our cast vote above.
   // @todo Look into all this, I honestly don't like it and it's a bit weird.
-  $form['vote']['vote']['#description'] = isset($new_element['vote']['#description']) ? $new_element['vote']['#description'] : '';
+  $form['vote']['vote']['#description'] = isset($new_element['vote']['#description']
+  ) ? $new_element['vote']['#description'] : '';
   if (!$form['vote']['#allow_revote'] && !$form['vote']['#allow_clear']) {
     $form['vote'] = $new_element;
   }
@@ -624,7 +660,8 @@ function fivestar_expand($element, $form_state, $complete_form) {
   $class[] = 'clearfix';
 
   $title = t('it');
-  if (isset($element['#settings']['entity_id']) && isset($element['#settings']['entity_type'])) {
+  if (isset($element['#settings']['entity_id']) && isset(
+    $element['#settings']['entity_type'])) {
     $entity_id = $element['#settings']['entity_id'];
     $entity = entity_load($element['#settings']['entity_type'], array($entity_id));
     $entity = $entity[$entity_id];
@@ -638,7 +675,8 @@ function fivestar_expand($element, $form_state, $complete_form) {
   $options = array('-' => t('Select rating'));
   for ($i = 1; $i <= $element['#stars']; $i++) {
     $this_value = ceil($i * 100 / $element['#stars']);
-    $options[$this_value] = t('Give @title @star/@count', array('@title' => $title, '@star' => $i, '@count' => $element['#stars']));
+    $options[$this_value] = t('Give @title @star/@count',
+    array('@title' => $title, '@star' => $i, '@count' => $element['#stars']));
   }
   // Display clear button only if enabled.
   if ($element['#allow_clear'] == TRUE) {
@@ -671,7 +709,8 @@ function fivestar_expand($element, $form_state, $complete_form) {
       break;
 
     case 'average':
-      $element['vote']['#description'] = $settings['style'] == 'dual' ? NULL : theme('fivestar_summary', array(
+      $element['vote']['#description'] = $settings['style'] ==
+      'dual' ? NULL : theme('fivestar_summary', array(
         'average_rating' => $values['average'],
         'votes' => $values['count'],
         'stars' => $settings['stars'],
@@ -681,7 +720,8 @@ function fivestar_expand($element, $form_state, $complete_form) {
       break;
 
     case 'smart':
-      $element['vote']['#description'] = ($settings['style'] == 'dual' && !$values['user']) ? NULL : theme('fivestar_summary', array(
+      $element['vote']['#description'] = ($settings['style'] ==
+      'dual' && !$values['user']) ? NULL : theme('fivestar_summary', array(
         'user_rating' => $values['user'],
         'average_rating' => $values['user'] ? NULL : $values['average'],
         'votes' => $settings['style'] == 'dual' ? NULL : $values['count'],
@@ -718,7 +758,8 @@ function fivestar_expand($element, $form_state, $complete_form) {
       break;
 
     case 'smart':
-      $class[] = 'fivestar-smart-stars ' . ($values['user'] ? 'fivestar-user-stars' : 'fivestar-average-stars');
+      $class[] = 'fivestar-smart-stars ' . ($values['user'] ?
+      'fivestar-user-stars' : 'fivestar-average-stars');
       break;
 
     case 'dual':
@@ -731,7 +772,8 @@ function fivestar_expand($element, $form_state, $complete_form) {
       ));
       if ($settings['text'] != 'none') {
         $static_description = theme('fivestar_summary', array(
-          'average_rating' => $settings['text'] == 'user' ? NULL : (isset($values['average']) ? $values['average'] : 0),
+          'average_rating' => $settings['text'] == 'user' ?
+          NULL : (isset($values['average']) ? $values['average'] : 0),
           'votes' => isset($values['count']) ? $values['count'] : 0,
           'stars' => $settings['stars'],
         ));
@@ -793,13 +835,13 @@ function fivestar_expand($element, $form_state, $complete_form) {
 /**
  * Helper function to get the correct default value for a fivestar element.
  *
- * @param $element
- *   The fivestar element
+ * @param array $element
+ *   The fivestar element.
  *
- * @return
+ * @return array
  *   The default value for the element.
  */
-function _fivestar_get_element_default_value($element) {
+function _fivestar_get_element_default_value(array $element) {
   if (isset($element['#default_value'])) {
     $default_value = $element['#default_value'];
   }
@@ -843,8 +885,10 @@ function _fivestar_get_element_default_value($element) {
  * An #element_validate function for "fivestar" elements.
  */
 function fivestar_validate($element, &$form_state) {
-  if ($element['#required'] && (empty($element['#value']) || $element['#value'] == '-')) {
-    form_error($element, t('@name field is required.', array('@name' => $element['#title'])));
+  if ($element['#required'] && (empty($element['#value']) ||
+  $element['#value'] == '-')) {
+    form_error($element, t('@name field is required.',
+    array('@name' => $element['#title'])));
   }
 }
 
@@ -855,15 +899,15 @@ function fivestar_votingapi_metadata_alter(&$data) {
   foreach (fivestar_get_tags() as $tag) {
     // Add several custom tags that are being used by fivestar.
     $data['tags'][$tag] = array(
-      'name' => t($tag),
-      'description' => t('@tag used by fivestar.', array('@tag' => $tag)),
+      'name' => $tag,
+      'description' => '@tag used by fivestar.', array('@tag' => $tag),
       'module' => 'fivestar',
     );
   }
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function fivestar_get_tags() {
   $tags_txt = variable_get('fivestar_tags', 'vote');
@@ -888,9 +932,13 @@ function fivestar_get_tags() {
 }
 
 /**
- *
+ * {@inheritdoc}
  */
-function fivestar_get_targets($field, $instance, $key = FALSE, $entity = FALSE, $langcode = LANGUAGE_NONE) {
+function fivestar_get_targets($field,
+ $instance,
+ $key = FALSE,
+$entity = FALSE,
+ $langcode = LANGUAGE_NONE) {
   $options = array();
   $targets = module_invoke_all('fivestar_target_info', $field, $instance);
   if ($key == FALSE) {
@@ -900,8 +948,10 @@ function fivestar_get_targets($field, $instance, $key = FALSE, $entity = FALSE,
     return $options;
   }
   else {
-    if (isset($targets[$key]) && !empty($targets[$key]['callback']) && function_exists($targets[$key]['callback'])) {
-      return call_user_func($targets[$key]['callback'], $entity, $field, $instance, $langcode);
+    if (isset($targets[$key]) && !empty($targets[$key]['callback']) &&
+    function_exists($targets[$key]['callback'])) {
+      return call_user_func($targets[$key]['callback'], $entity,
+      $field, $instance, $langcode);
     }
   }
 }
@@ -921,11 +971,17 @@ function fivestar_fivestar_target_info($field, $instance) {
   if (module_exists('node_reference')) {
     $field_names = array_keys(field_read_fields(array('module' => 'node_reference')));
     if (!empty($field_names)) {
-      $field_instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_names));
+      $field_instances = field_read_instances(array(
+        'entity_type' => $entity_type,
+        'bundle' => $bundle,
+        'field_name' => $field_names,
+      ));
       if (!empty($field_instances)) {
         foreach ($field_instances as $field_instance) {
           $options[$field_instance['field_name']] = array(
-            'title' => t('Node reference: @field', array('@field' => $field_instance['field_name'])),
+            'title' => t('Node reference: @field', array(
+              '@field' => $field_instance['field_name'],
+            )),
             'callback' => '_fivestar_target_node_reference',
           );
         }
@@ -937,11 +993,17 @@ function fivestar_fivestar_target_info($field, $instance) {
   if (module_exists('entityreference')) {
     $field_names = array_keys(field_read_fields(array('module' => 'entityreference')));
     if (!empty($field_names)) {
-      $field_instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_names));
+      $field_instances = field_read_instances(array(
+        'entity_type' => $entity_type,
+        'bundle' => $bundle,
+        'field_name' => $field_names,
+      ));
       if (!empty($field_instances)) {
         foreach ($field_instances as $field_instance) {
           $options[$field_instance['field_name']] = array(
-            'title' => t('Entity reference: @field', array('@field' => $field_instance['field_name'])),
+            'title' => t('Entity reference: @field', array(
+              '@field' => $field_instance['field_name'],
+            )),
             'callback' => '_fivestar_target_entityreference',
           );
         }
@@ -953,11 +1015,19 @@ function fivestar_fivestar_target_info($field, $instance) {
   if (module_exists('user_reference')) {
     $field_names = array_keys(field_read_fields(array('module' => 'user_reference')));
     if (!empty($field_names)) {
-      $field_instances = field_read_instances(array('entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_names));
+      $field_instances = field_read_instances(array(
+        'entity_type' =>
+        $entity_type,
+        'bundle' => $bundle,
+        'field_name' => $field_names,
+      ));
       if (!empty($field_instances)) {
         foreach ($field_instances as $field_instance) {
           $options[$field_instance['field_name']] = array(
-            'title' => t('User reference: @field', array('@field' => $field_instance['field_name'])),
+            'title' => t('User reference: @field', array(
+              '@field' =>
+              $field_instance['field_name'],
+            )),
             'callback' => '_fivestar_target_user_reference',
           );
         }
@@ -977,6 +1047,7 @@ function fivestar_fivestar_target_info($field, $instance) {
 }
 
 /**
+ * {@inheritdoc}
  *
  * @return array
  *   array('entity_type', 'entity_id').
@@ -985,7 +1056,8 @@ function _fivestar_target_node_reference($entity, $field, $instance, $langcode)
   $target = array();
 
   $node_reference = $instance['settings']['target'];
-  if (isset($entity->{$node_reference}[$langcode][0]) && is_numeric($entity->{$node_reference}[$langcode][0]['nid'])) {
+  if (isset($entity->{$node_reference}[$langcode][0]) &&
+  is_numeric($entity->{$node_reference}[$langcode][0]['nid'])) {
     $target['entity_id'] = $entity->{$node_reference}[$langcode][0]['nid'];
     $target['entity_type'] = 'node';
   }
@@ -994,7 +1066,10 @@ function _fivestar_target_node_reference($entity, $field, $instance, $langcode)
 }
 
 /**
- * @return (array) array('entity_type', 'entity_id')
+ * {@inheritdoc}
+ *
+ * @return array
+ *   Returns array.
  */
 function _fivestar_target_entityreference($entity, $field, $instance, $langcode) {
   $target = array();
@@ -1004,7 +1079,9 @@ function _fivestar_target_entityreference($entity, $field, $instance, $langcode)
   // Retrieve entity settings for the referenced field.
   $field_info = field_info_field($entityreference);
 
-  if (isset($entity->{$entityreference}[$langcode][0]) && isset($entity->{$entityreference}[$langcode][0]['target_id']) && is_numeric($entity->{$entityreference}[$langcode][0]['target_id'])) {
+  if (isset($entity->{$entityreference}[$langcode][0]) &&
+  isset($entity->{$entityreference}[$langcode][0]['target_id'])
+  && is_numeric($entity->{$entityreference}[$langcode][0]['target_id'])) {
     $target['entity_id'] = $entity->{$entityreference}[$langcode][0]['target_id'];
     $target['entity_type'] = $field_info['settings']['target_type'];
   }
@@ -1013,6 +1090,7 @@ function _fivestar_target_entityreference($entity, $field, $instance, $langcode)
 }
 
 /**
+ * {@inheritdoc}
  *
  * @return array
  *   array('entity_type', 'entity_id').
@@ -1021,7 +1099,8 @@ function _fivestar_target_user_reference($entity, $field, $instance, $langcode)
   $target = array();
 
   $user_reference = $instance['settings']['target'];
-  if (isset($entity->{$user_reference}[$langcode][0]) && is_numeric($entity->{$user_reference}[$langcode][0]['uid'])) {
+  if (isset($entity->{$user_reference}[$langcode][0]) &&
+  is_numeric($entity->{$user_reference}[$langcode][0]['uid'])) {
     $target['entity_id'] = $entity->{$user_reference}[$langcode][0]['uid'];
     $target['entity_type'] = 'user';
   }
@@ -1030,7 +1109,7 @@ function _fivestar_target_user_reference($entity, $field, $instance, $langcode)
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function _fivestar_target_comment_parent_node($entity, $field, $instance, $langcode) {
   return array(
@@ -1043,6 +1122,7 @@ function _fivestar_target_comment_parent_node($entity, $field, $instance, $langc
  * Helper function to determine if a user can vote on content.
  *
  * @return bool
+ *   Returns bool.
  */
 function _fivestar_allow_vote($element) {
   global $user;
@@ -1054,8 +1134,10 @@ function _fivestar_allow_vote($element) {
   }
   else {
     $criteria = array(
-      'entity_id' => isset($element['#settings']['content_id']) ? $element['#settings']['content_id'] : NULL,
-      'entity_type' => isset($element['#settings']['content_type']) ? $element['#settings']['content_type'] : NULL,
+      'entity_id' => isset($element['#settings']['content_id'])
+      ? $element['#settings']['content_id'] : NULL,
+      'entity_type' => isset($element['#settings']['content_type'])
+      ? $element['#settings']['content_type'] : NULL,
       'tag' => isset($element['#settings']['tag']) ? $element['#settings']['tag'] : NULL,
       'uid' => $user->uid,
     );
@@ -1070,7 +1152,8 @@ function _fivestar_allow_vote($element) {
     return TRUE;
   }
   // Check that we have entity details, allow if not.
-  if (!isset($element['#settings']['entity_id']) || !isset($element['#settings']['entity_type'])) {
+  if (!isset($element['#settings']['entity_id']) || !isset(
+    $element['#settings']['entity_type'])) {
     return TRUE;
   }
   $entity_id = $element['#settings']['entity_id'];
@@ -1078,15 +1161,15 @@ function _fivestar_allow_vote($element) {
   $entity = $entity[$entity_id];
   $uid1 = $entity->uid;
   $uid2 = $user->uid;
-  return $entity->uid != $user->uid;
+  return $uid1 != $uid2;
 }
 
 /**
- * Implements hook_ctools_content_subtype_alter()
+ * Implements hook_ctools_content_subtype_alter().
  */
 function fivestar_ctools_content_subtype_alter(&$subtype, &$plugin) {
   if ($plugin['name'] == 'entity_field' && isset($subtype['subtype_id'])) {
-    list($entity_type, $field_name) = explode(':', $subtype['subtype_id'], 2);
+    list($field_name) = explode(':', $subtype['subtype_id'], 2);
     $field = field_info_field($field_name);
     if ($field['type'] == 'fivestar') {
       $subtype['render callback'] = 'fivestar_fivestar_field_content_type_render';
@@ -1155,7 +1238,8 @@ function fivestar_fivestar_field_content_type_render($subtype, $conf, $panel_arg
 
   $clone = clone $entity;
   $clone->{$field_name}[$language] = $all_values;
-  $field_output = field_view_field($entity_type, $clone, $field_name, $field_settings, $language);
+  $field_output = field_view_field($entity_type, $clone, $field_name,
+  $field_settings, $language);
 
   if (!empty($field_output) && !empty($conf['override_title'])) {
     $field_output['#title'] = filter_xss_admin($conf['override_title_text']);
diff --git a/includes/fivestar.field.inc b/includes/fivestar.field.inc
index 4270e3a..18f5b54 100644
--- a/includes/fivestar.field.inc
+++ b/includes/fivestar.field.inc
@@ -29,11 +29,11 @@ function fivestar_field_info() {
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function fivestar_form_field_ui_field_edit_form_alter(&$form, $form_state) {
   $field = $form['#field'];
-  $instance = $form['#instance'];
+  // $instance = $form['#instance'];
   if ($field['type'] == 'fivestar') {
     // Multiple values is not supported with Fivestar.
     $form['field']['cardinality']['#access'] = FALSE;
@@ -63,7 +63,7 @@ function fivestar_field_settings_form($field, $instance) {
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function fivestar_field_instance_settings_form($field, $instance) {
   $form = array();
@@ -138,13 +138,13 @@ function fivestar_field_views_data($field) {
   $data = field_views_field_default_views_data($field);
   foreach ($data as $table_name => $table_data) {
     // Add our handler to the rating views field.
-    $data[$table_name][$field['field_name'] . '_rating']['filter']['handler'] = 'fivestar_views_handler_filter_in_operator';
+    $data[$table_name][$field['field_name'] . '_rating']['filter']['handler'] = 'FivestarViewsHandlerFilterInOperator';
   }
   return $data;
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function _fivestar_field_helper($entity_type, $entity, $field, $instance, $langcode, &$items, $op = '') {
   foreach ($items as $delta => $item) {
@@ -192,8 +192,9 @@ function _fivestar_field_target($entity, $field, $instance, $item, $langcode) {
     $target = fivestar_get_targets($field, $instance, $instance['settings']['target'], $entity, $langcode);
   }
   else {
-    // If all else fails, default to voting on the instance the field is attached to.
-    list($id, $vid, $bundle) = entity_extract_ids($instance['entity_type'], $entity);
+    // If all else fails, default to voting on the instance
+    // the field is attached to.
+    list($id) = entity_extract_ids($instance['entity_type'], $entity);
     $target = array(
       'entity_id' => $id,
       'entity_type' => $instance['entity_type'],
@@ -279,7 +280,7 @@ function fivestar_field_widget_settings_form($field, $instance) {
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function fivestar_previews_expand($element) {
 
@@ -311,10 +312,10 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
     }
     $element['rating'] = array(
       '#type' => 'select',
-      '#title' => check_plain(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') : $instance['label']) : FALSE),
       '#options' => $options,
       '#default_value' => isset($items[$delta]['rating']) ? $items[$delta]['rating'] : NULL,
-      '#description' => check_plain(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') : $instance['description']) : FALSE),
       '#required' => isset($instance['required']) ? $instance['required'] : FALSE,
     );
   }
@@ -345,7 +346,7 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
 
     $element['rating'] = array(
       '#type' => 'fivestar',
-      '#title' => check_plain(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') : $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,
@@ -354,7 +355,7 @@ function fivestar_field_widget_form(&$form, &$form_state, $field, $instance, $la
       '#widget' => $widget,
       '#settings' => $settings,
       '#values' => $values,
-      '#description' => check_plain(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') : $instance['description']) : FALSE),
       '#required' => isset($instance['required']) ? $instance['required'] : FALSE,
     );
   }
@@ -501,14 +502,6 @@ function fivestar_field_formatter_settings_summary($field, $instance, $view_mode
  * The render array will be either a form array created with
  * drupal_get_form() or a custom render array, to be sent to a
  * fivestar theme function.
- *
- * @param $items
- *   Array. Generated by fivestar_field_prepare_view(). This array contains
- *   processed voting info.
- *
- * @return element
- *   Renderable array. This array will always be $element[0], with only one
- *   top level item, because Fivestar does not offer multi-value fields.
  */
 function fivestar_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
   $element = array();
@@ -532,7 +525,7 @@ function fivestar_field_formatter_view($entity_type, $entity, $field, $instance,
     // @todo Get rid of voting categories setting, then change this so
     // axis = field name.
     $tag = (isset($field['settings']['axis'])) ? $field['settings']['axis'] : 'vote';
-    list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
+    list($id) = entity_extract_ids($entity_type, $entity);
     $settings = _fivestar_custom_widget_settings($entity_type, $instance, $display, $id, $tag, $widget);
     // Store entity and field data for later reuse.
     $settings += array(
@@ -572,7 +565,7 @@ function fivestar_field_formatter_view($entity_type, $entity, $field, $instance,
   // Determine which sets of stars are going to be displayed.
   // Options:
   // - Only show average of all votes.
-  // - Only show the user his/her own vote.
+  // - Only show the user their own vote.
   // - Show both the average and the user's own votes.
   $style = $display['settings']['style'];
   $show_average_stars = ($style == 'average' || $style == 'dual' || ($style == 'smart' && empty($values['user'])));
@@ -687,23 +680,27 @@ function _fivestar_custom_widget_settings($entity_type, $instance, $display, $id
 }
 
 /**
- * @param $widgets
- *   Array, $widgets = module_invoke_all('fivestar_widgets');
- *   $widgets = array('path/to/css' => 'Widget Name', 'path/to/more/css' => 'Widget 2');
+ * {@inheritdoc}
  *
- * @param $display
- *   Array. This is the $display parameter passed to fivestar_field_formatter_view().
- *
- * @param $instance
- *   Array. This is the $instance parameter passed to fivestar_field_formatter_view().
+ * @param array $widgets
+ *   Array, $widgets = module_invoke_all('fivestar_widgets');
+ *   $widgets = array('path/to/css' => 'Widget Name',
+ *   'path/to/more/css' => 'Widget 2');.
+ * @param array $display
+ *   This is the $display parameter passed to fivestar_field_formatter_view().
+ * @param array $instance
+ *   This is the $instance parameter passed to fivestar_field_formatter_view().
  *
  * @return array
- *   $widget = array('name' => 'my widget', 'css' => 'sites/all/mymodule/mywidget.css');
+ *   $widget = array('name' => 'my widget',
+ *   'css' => 'sites/all/mymodule/mywidget.css');
  */
-function _fivestar_get_widget($widgets, $display, $instance) {
+function _fivestar_get_widget(array $widgets, array $display, array $instance) {
   // If the type doesn't required widgets lets get out of here.
   // @todo Implement this WAY better.
-  if (in_array($display['type'], array('fivestar_formatter_rating', 'fivestar_formatter_percentage'))) {
+  if (in_array($display['type'], array('fivestar_formatter_rating',
+    'fivestar_formatter_percentage',
+  ))) {
     return FALSE;
   }
 
@@ -715,13 +712,15 @@ function _fivestar_get_widget($widgets, $display, $instance) {
   if (!$fivestar_widget = $display['settings']['widget']['fivestar_widget']) {
     // No display has been selected and saved by the user.
     if ($type == 'exposed') {
-      // Stars rated while viewing, that is, $type = 'exposed', fall backs on 'default'
+      // Stars rated while viewing, that is, $type = 'exposed',
+      // fall backs on 'default'
       // (which is the same as nothing).
       $fivestar_widget = 'default';
     }
     elseif ($type == 'stars') {
       // Stars rated while editing, that is, $type = stars,
-      // falls back on whatever the user selected to be displayed on node/add and node/%/edit.
+      // falls back on whatever the user selected to be displayed
+      // on node/add and node/%/edit.
       $fivestar_widget = $instance['widget']['settings']['widget']['fivestar_widget'];
     }
   }
@@ -798,7 +797,7 @@ function fivestar_property_info_callback(&$info, $entity_type, $field, $instance
       'microdata' => TRUE,
     ),
     'user_rating' => array(
-      'label' => t('User\'s Rating'),
+      'label' => t("User's Rating"),
       'type' => 'text',
       'microdata' => TRUE,
     ),
diff --git a/includes/fivestar.theme.inc b/includes/fivestar.theme.inc
index 71feaaf..90eb746 100644
--- a/includes/fivestar.theme.inc
+++ b/includes/fivestar.theme.inc
@@ -9,7 +9,7 @@
  * Show a preview of a widget using a custom CSS file.
  */
 function theme_fivestar_preview_widget($variables) {
-  $path = drupal_get_path('module', 'fivestar');
+  // $path = drupal_get_path('module', 'fivestar');
   $form = array(
     '#post' => array(),
     '#programmed' => FALSE,
@@ -40,8 +40,8 @@ function theme_fivestar_preview_widget($variables) {
 
   // Attach necessary JS settings.
   $settings = array(
-    'titleUser' => t('Your rating') . ': ',
-    'titleAverage' => t('Average') . ': ',
+    'titleUser' => t('Your rating:'),
+    'titleAverage' => t('Average:'),
     'feedbackSavingVote' => t('Saving your vote...'),
     'feedbackVoteSaved' => t('Your vote has been saved.'),
     'feedbackDeletingVote' => t('Deleting your vote...'),
@@ -60,7 +60,7 @@ function theme_fivestar_preview_widget($variables) {
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function theme_fivestar_preview($variables) {
   extract($variables, EXTR_SKIP);
@@ -92,7 +92,7 @@ function theme_fivestar_preview($variables) {
 }
 
 /**
- *
+ * {@inheritdoc}
  */
 function theme_fivestar_preview_wrapper($variables) {
   return '<div class="fivestar-preview fivestar-preview-' . $variables['type'] . '">' . $variables['content'] . '</div>';
@@ -123,7 +123,11 @@ function theme_fivestar_formatter_default($variables) {
     'widget' => $element['#widget'],
   );
   $star_display = theme('fivestar_static', $variables);
-  return theme('fivestar_static_element', array('description' => $element['#description'], 'star_display' => $star_display, 'is_form' => FALSE));
+  return theme('fivestar_static_element', array(
+    'description' => $element['#description'],
+    'star_display' => $star_display,
+    'is_form' => FALSE,
+  ));
 }
 
 /**
@@ -168,8 +172,9 @@ function theme_fivestar($variables) {
 }
 
 /**
- * Theme the straight HTML version of the fivestar select list. This is used
- * to remove the wrapping 'form-item' div from the select list.
+ * Theme the straight HTML version of the fivestar select list.
+ *
+ * This is used to remove the wrapping 'form-item' div from the select list.
  */
 function theme_fivestar_select($variables) {
   $element = $variables['element'];
@@ -181,17 +186,9 @@ function theme_fivestar_select($variables) {
 /**
  * Display a plain HTML view-only version of the widget with a specified rating.
  *
- * @param $rating
- *   The desired rating to display out of 100 (i.e. 80 is 4 out of 5 stars).
- * @param $stars
- *   The total number of stars this rating is out of.
- * @param $tag
- *   Allows multiple ratings per node.
- *
- * @return
- *   A themed HTML string representing the star widget.
+ * {@inheritdoc}
  */
-function theme_fivestar_static($variables) {
+function theme_fivestar_static(array $variables) {
   $rating = $variables['rating'];
   $stars = $variables['stars'];
   $tag = $variables['tag'];
@@ -244,16 +241,7 @@ function theme_fivestar_static($variables) {
  *
  * All ratings are from 0 to 100.
  *
- * @param $user_rating
- *   The current user's rating.
- * @param $average
- *   The average rating.
- * @param $votes
- *   The total number of votes.
- * @param $stars
- *   The number of stars being displayed.
- *
- * @return
+ * @return string
  *   A themed HTML string representing the star widget.
  */
 function theme_fivestar_summary($variables) {
diff --git a/includes/fivestar_views_handler_filter_in_operator.inc b/includes/fivestar_views_handler_filter_in_operator.inc
deleted file mode 100644
index bdda261..0000000
--- a/includes/fivestar_views_handler_filter_in_operator.inc
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-
-/**
- * @file
- * Provides the view handling functions for fivestar.
- */
-
-/**
- *
- */
-class fivestar_views_handler_filter_in_operator extends views_handler_filter_in_operator {
-
-  /**
-   * Initialize handler.
-   */
-  public function init(&$view, &$options) {
-    parent::init($view, $options);
-    // We handle empty/not empty ourselves.
-    $this->definition['allow empty'] = FALSE;
-  }
-
-  /**
-   * Get the possible options (the number of stars).
-   */
-  public function get_value_options() {
-    if (isset($this->value_options)) {
-      return;
-    }
-
-    // Get field info to figure out the number of stars configured for it.
-    $field_name = $this->definition['field_name'];
-    $field_info = field_info_field($field_name);
-    $bundles = reset($field_info['bundles']);
-    $entity_type = key($field_info['bundles']);
-    $bundle_name = $bundles[0];
-    $field_instance = field_info_instance($entity_type, $field_name, $bundle_name);
-
-    $max_stars = !empty($field_instance['settings']['stars']) ? $field_instance['settings']['stars'] : 5;
-    $options = array(0 => t('No stars'));
-    for ($i = 1; $i <= $max_stars; $i++) {
-      $percentage = ceil($i * 100 / $max_stars);
-      $options[$percentage] = format_plural($i, '1 star', '@count stars');
-    }
-    $this->value_options = $options;
-  }
-
-  /**
-   * Operator callback.
-   */
-  public function op_simple() {
-    if (empty($this->value)) {
-      return;
-    }
-    $this->ensure_my_table();
-
-    // Zero needs special handling.
-    $has_nul = in_array(0, $this->value);
-
-    $or_statement = db_or();
-    $and_statement = db_and();
-    // Add regular condition if we have any values other than zero.
-    if (count($this->value) > ($has_nul ? 1 : 0)) {
-      $or_statement->condition("$this->table_alias.$this->real_field", array_values($this->value), $this->operator);
-    }
-
-    $selected_val_count = count(array_values($this->value));
-    $first_element = reset($this->value);
-    // 'IN' Condition.
-    if ($this->operator == 'in') {
-      if ($selected_val_count == 1) {
-        if ($first_element == 0) {
-          $nul_operator = ($has_nul == 0) ? 'IS NOT NULL' : 'IS NULL';
-          $or_statement->condition("$this->table_alias.$this->real_field", NULL, $nul_operator);
-          $this->query->add_where($this->options['group'], $or_statement);
-        }
-        elseif ($first_element != 0) {
-          $operator = 'IN';
-          $and_statement->condition("$this->table_alias.$this->real_field", array_values($this->value), $operator);
-          $this->query->add_where($this->options['group'], $and_statement);
-        }
-      }
-      elseif ($selected_val_count > 1) {
-        if ($first_element == 0) {
-          $nul_operator = ($has_nul == 0) ? 'IS NOT NULL' : 'IS NULL';
-          $or_statement->condition("$this->table_alias.$this->real_field", NULL, $nul_operator);
-          $this->query->add_where($this->options['group'], $or_statement);
-        }
-        elseif ($first_element != 0) {
-          $operator = 'IN';
-          $and_statement->condition("$this->table_alias.$this->real_field", array_values($this->value), $operator);
-          $this->query->add_where($this->options['group'], $and_statement);
-        }
-      }
-    }
-    // 'NOT IN' Condition.
-    elseif ($this->operator == 'not in') {
-      if ($has_nul == 1 && $first_element == 0) {
-        if ($selected_val_count == 1) {
-          $nul_operator = 'IS NOT NULL';
-          $and_statement->condition("$this->table_alias.$this->real_field", array_values($this->value), $nul_operator);
-          $this->query->add_where($this->options['group'], $and_statement);
-        }
-        elseif ($selected_val_count > 1) {
-          $operator = 'NOT IN';
-          $nul_operator = 'IS NOT NULL';
-          $and_statement->condition("$this->table_alias.$this->real_field", array_values($this->value), $operator);
-          $and_statement->condition("$this->table_alias.$this->real_field", NULL, $nul_operator);
-          $this->query->add_where($this->options['group'], $and_statement);
-        }
-      }
-      elseif ($has_nul == 0) {
-        $nul_operator = 'IS NULL';
-        $or_statement->condition("$this->table_alias.$this->real_field", NULL, $nul_operator);
-        $this->query->add_where($this->options['group'], $or_statement);
-      }
-    }
-  }
-
-}
diff --git a/test/fivestar.base.test b/test/fivestar.base.test
index 73bc1a1..de9886a 100644
--- a/test/fivestar.base.test
+++ b/test/fivestar.base.test
@@ -13,17 +13,26 @@ class FivestarBaseTestCase extends AJAXTestCase {
   /**
    * Use testing profile.
    *
+   * @var profile
+   * The profile.
+   *
    * @see http://groups.drupal.org/node/217189
    */
   protected $profile = 'testing';
 
   /**
    * A user with permission to administer Fivestar.
+   *
+   * @var adminUser
+   * The admin user.
    */
   protected $adminUser;
 
   /**
    * A user with permission to vote.
+   *
+   * @var voterUser
+   * The voter user.
    */
   protected $voterUser;
 
@@ -33,9 +42,14 @@ class FivestarBaseTestCase extends AJAXTestCase {
   public function setUp() {
     parent::setUp(array('fivestar', 'dblog'));
 
-    $type = $this->drupalCreateContentType(array('type' => 'test_node_type', 'name' => 'test_node_type'));
-    $this->adminUser = $this->drupalCreateUser(array('create test_node_type content', 'rate content'));
-    $this->voterUser = $this->drupalCreateUser(array('rate content'));
+    // $type = $this->drupalCreateContentType(array('type' => 'test_node_type',
+    // 'name' => 'test_node_type'));
+    $this->adminUser = $this->drupalCreateUser(
+      array('create test_node_type content',
+        'rate content',
+      ));
+    $this->voterUser = $this->drupalCreateUser(
+      array('rate content'));
   }
 
   /**
