diff --git a/pollfield.info b/pollfield.info
index 191dcf0..7c200ba 100644
--- a/pollfield.info
+++ b/pollfield.info
@@ -8,3 +8,10 @@ version = "7.x-1.x-dev"
 core = "7.x"
 project = "pollfield"
 datestamp = "1318680418"
+
+; Information added by drupal.org packaging script on 2011-11-12
+version = "7.x-2.x-dev"
+core = "7.x"
+project = "pollfield"
+datestamp = "1321101173"
+
diff --git a/pollfield.module b/pollfield.module
index 347b667..efdc4d2 100644
--- a/pollfield.module
+++ b/pollfield.module
@@ -5,7 +5,6 @@
  * Provides the description of the field.
  */
 function pollfield_field_info() {
-
   return array(
     // We name our field as the associative name of the array.
     'pollfield_poll' => array(//this is name of field that evetrhing else is connected
@@ -15,7 +14,6 @@ function pollfield_field_info() {
       'default_formatter' => 'pollfield_default',
     ),
   );
-	
 }
 /*
  * Implements hook_field_validate().
@@ -58,7 +56,6 @@ function pollfield_field_is_empty($item, $field) {
  * @see field_example_field_formatter_view()
  */
 function pollfield_field_formatter_info() {
-	
   return array(
     // This formatter just displays the hex value in the color indicated.
     'pollfield_default' => array(
@@ -90,29 +87,29 @@ function pollfield_field_formatter_info() {
  * hook field create
  * used to serialize some pollfield settings
  */
- function pollfield_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
- 		
-		foreach ($items as $delta=>$item){
-			//poll settings
-			$poll_settings['poll_type'] = $item['poll_type'];
-			$poll_settings['delete_votes'] = $item['delete_votes'];
-			$poll_settings['cancelvote_allow'] = $item['cancelvote_allow'];
-			$poll_settings['result_allow'] = $item['result_allow'];
-			$items[$delta]['poll_features'] = serialize($poll_settings);
-			//chioces
-			//delete empty choices
-			$choices_items=array();
-			foreach ($item['group'] as $key => $value) {
-				if (strlen($value['choice'])<2){
-					
-				}else{
-					$choices_items[]=$value;
-				}
-			}
-			$choices=serialize($choices_items);
-			$items[$delta]['choice'] = $choices; 
-		}
- }
+function pollfield_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
+  foreach ($items as $delta=>$item){
+  	//poll settings
+  	$poll_settings['poll_type'] = $item['poll_type'];
+  	$poll_settings['delete_votes'] = $item['delete_votes'];
+  	$poll_settings['cancelvote_allow'] = $item['cancelvote_allow'];
+  	$poll_settings['result_allow'] = $item['result_allow'];
+  	$items[$delta]['poll_features'] = serialize($poll_settings);
+  	//chioces
+  	//delete empty choices
+  	$choices_items=array();
+  	foreach ($item['group'] as $key => $value) {
+  		if (strlen($value['choice'])<2) {
+  			
+  		}
+  		else {
+  			$choices_items[]=$value;
+  		}
+  	}
+  	$choices=serialize($choices_items);
+  	$items[$delta]['choice'] = $choices; 
+  }
+}
  
 /**
  * Implements hook_field_formatter_view().
@@ -127,16 +124,15 @@ function pollfield_field_formatter_info() {
  */
 function pollfield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
   $element = array();
-	
   switch ($display['type']) {
     // This formatter simply outputs the field as text and with a color.
     case 'pollfield_default':
       foreach ($items as $delta => $item) {
-      	$elements['item']=$item;
-				$elements['entity']=$entity;
-				$elements['delta']=$delta;
-				$elements['field']=$field;
-      	$output=theme('pollfield_default_formatter',array('elements'=>$elements));
+      	$elements['item'] = $item;
+				$elements['entity'] = $entity;
+				$elements['delta'] = $delta;
+				$elements['field'] = $field;
+      	$output = theme('pollfield_default_formatter', array('elements'=>$elements));
         $element[$delta] = array(
           // We create a render array to produce the desired markup,
           // "<p style="color: #hexcolor">The color code ... #hexcolor</p>".
@@ -200,6 +196,7 @@ function pollfield_field_formatter_view($entity_type, $entity, $field, $instance
 
   return $element;
 }
+
 /**
  * Implements hook_field_widget_info().
  *
@@ -222,6 +219,7 @@ function pollfield_field_widget_info() {
     ),
   );
 }
+
 /**
  * Implements hook_field_widget_form().
  *
@@ -239,9 +237,7 @@ function pollfield_field_widget_form(&$form, &$form_state, $field, $instance, $l
   $widget['#delta'] = $delta;
 
   switch ($instance['widget']['type']) {
-
     case 'pollfield_main':
-			
 			//question 
       $widget['question'] = array(
         '#type' => 'textfield',
@@ -249,7 +245,7 @@ function pollfield_field_widget_form(&$form, &$form_state, $field, $instance, $l
         '#default_value'=>$value,
       );
 			//status
-			$admin_pollfield=TRUE;
+			$admin_pollfield = TRUE;
 			$_active = array(0 => t('Closed'), 1 => t('Active'));
 		  $widget['active']= array(
 		    '#type' => 'radios',
@@ -260,17 +256,17 @@ function pollfield_field_widget_form(&$form, &$form_state, $field, $instance, $l
 		    '#options' => $_active,
 		    '#description' => t('When a pollfield is closed, visitors can no longer vote for it.')
 		  );
-			 //runtime - duration
-			 $widget['runtime'] = array(
-		    '#type' => 'select',
-		    '#access' => $admin_pollfield,
-		    '#title' => t('Duration'),
-		    // If no value exists, always default to Unlimited (0)
-		    '#default_value' => isset($items[$delta]['runtime']) ? $items[$delta]['runtime'] : 0,
-		    '#options' => pollfield_duration_options(),
-		    '#description' => t('After this period, the pollfield will be closed automatically.')
-		   );
-			 //anonymous voting
+      //runtime - duration
+      $widget['runtime'] = array(
+        '#type' => 'select',
+        '#access' => $admin_pollfield,
+        '#title' => t('Duration'),
+        // If no value exists, always default to Unlimited (0)
+        '#default_value' => isset($items[$delta]['runtime']) ? $items[$delta]['runtime'] : 0,
+        '#options' => pollfield_duration_options(),
+        '#description' => t('After this period, the pollfield will be closed automatically.')
+      );
+			//anonymous voting
 			$widget['anonymous'] = array(
 		    '#type' => 'select',
 		    '#access' => $admin_pollfield,
@@ -358,9 +354,6 @@ function pollfield_field_widget_form(&$form, &$form_state, $field, $instance, $l
 			$form_state['field_lang']=$field_lang;
 			$form_state['field_delta']=$delta;
 			
-			
-			
-			
 			$widget['group'] = array(
 	        '#prefix' => '<div id="'.$wrapper.'">',
 	        '#suffix' => '</div>',
@@ -368,7 +361,6 @@ function pollfield_field_widget_form(&$form, &$form_state, $field, $instance, $l
 			$count_chioces=0;
 			
 			for ($i=0;$i<$number_of_choices+1;$i++){
-				
 				if (true){
 					$widget['group'][$count_chioces] = array(
 		        '#type' => 'fieldset',
@@ -412,8 +404,6 @@ function pollfield_field_widget_form(&$form, &$form_state, $field, $instance, $l
 	      }
 			}
 		
-			
-			
 			$widget['add-more'] = array(
 	      '#type' => 'submit',
 	      '#value' => t('More choices'),
@@ -431,9 +421,7 @@ function pollfield_field_widget_form(&$form, &$form_state, $field, $instance, $l
 		      // ajax_example_dependent_dropdown for 'event'.
 	     	),
     	);
-			
 			break;
-   
   }
 	
 	//question is name of field in field database
@@ -470,7 +458,6 @@ function pollfield_more_choice_callback_js($form, $form_state){
  */
 function pollfield_more_choice_callback_submit($form, &$form_state){
 	$form_state['count_choices']=$form_state['count_choices']+1;
-
 	$form_state['rebuild'] = TRUE;
 }
 
@@ -485,7 +472,6 @@ function pollfield_more_choice_callback_submit($form, &$form_state){
  * @see form_error()
  */
 function pollfield_field_widget_error($element, $error, $form, &$form_state) {
-	
   switch ($error['error']) {
     case 'field_example_invalid':
       form_error($element, $error['message']);
@@ -493,7 +479,6 @@ function pollfield_field_widget_error($element, $error, $form, &$form_state) {
   }
 }
 
-
 /**
  * Implements hook_menu().
  *
@@ -509,6 +494,7 @@ function pollfield_menu() {
   );
   return $items;
 }
+
 /**
  * Save vote vote information.
  *
@@ -593,7 +579,6 @@ function pollfield_save_choice($vote, $node) {
  * Write a vote to the database
  */
 function pollfield_save_vote_record($vote, $choice) {
-
   // Store user id if the user is logged in
   if ($vote->uid > 0) {
     db_query("INSERT INTO {pollfield_votes} (nid, field_table, field_name, uid, delta, field_name_delta)
@@ -617,22 +602,18 @@ function pollfield_save_vote_record($vote, $choice) {
  * Cancel a user's vote on a poll
  */
 function pollfield_cancel_choice($vote) {
-
-
   // Get total votes
   $field_votes = $vote->field_name .'_votes';
 	$table = 'field_revision_'.$vote->field_name;
 	$table_data = 'field_data_'.$vote->field_name;
 	$query = "SELECT ".$field_votes." FROM {".$table."} WHERE entity_id=".$vote->nid." AND delta=".$vote->field_name_delta;
   $total_votes = db_query($query)->fetchField();
-  
 
   // Cancel all the votes by this user on this poll
   $cancel_vote = pollfield_cancel_vote_record($vote);
 
   // Decrement total votes for this pollfield
   $total_votes--;
- 
 	$query="UPDATE {".$table."} SET ".$field_votes."=".$total_votes." WHERE entity_id=".$vote->nid." AND delta=".$vote->field_name_delta;
   db_query($query);
   $query="UPDATE {".$table_data."} SET ".$field_votes."=".$total_votes." WHERE entity_id=".$vote->nid." AND delta=".$vote->field_name_delta;
@@ -651,7 +632,6 @@ function pollfield_cancel_choice($vote) {
  *   Vote object
  */
 function pollfield_cancel_vote_record($vote) {
-
   if ($vote->uid) {
     db_query("DELETE from {pollfield_votes}
       WHERE nid = :nid AND field_table=:field_table AND field_name=:field_name AND uid = :uid AND field_name_delta=:field_name_delta",
@@ -702,11 +682,8 @@ function pollfield_vote() {
   else {
     $vote->cookie = $cookie;
   }
-
   $node = node_load($vote->nid);
 
-  
-
   // Get poll features
   $field_name = $vote->field_name;
   $field = $node->$field_name;
@@ -737,7 +714,6 @@ function pollfield_vote() {
 	*/
   // Clear the cache
   pollfield_clear($node);
-
 }
 
 /**
@@ -795,7 +771,7 @@ function pollfield_cookie_id_generator() {
 function pollfield_user_voted($elements) {
   global $user;
 	
-	$node=$elements['entity'];
+	$node = $elements['entity'];
 	
 	$field_name = $elements['field']['field_name'];
 	$field_table = 'field_revision_'.$field_name;
@@ -808,7 +784,7 @@ function pollfield_user_voted($elements) {
 	$is_voted = 0;
   $tnid = db_query("SELECT tnid FROM {node} WHERE nid=:nid", array(':nid'=>$nid))->fetchField();
 	
-  if ($tnid==0) {//there is no translation
+  if ($tnid == 0) {//there is no translation
     $t_nodes_results=db_query("SELECT nid FROM {node} WHERE nid = :nid", array(':nid'=>$nid));
   }
   else { //there is translation
@@ -816,7 +792,7 @@ function pollfield_user_voted($elements) {
   }
 	
   while ($t_nodes = $t_nodes_results->fetchObject()) {//check all translations
-    $t_nid=$t_nodes->nid;
+    $t_nid = $t_nodes->nid;
 
     // Get anonymous vote settings
     $field = $elements['item'];
@@ -852,7 +828,7 @@ function pollfield_user_voted($elements) {
 
         $voted = db_query("SELECT count(*) from {pollfield_votes}
           WHERE nid = :nid AND field_table= :field_table AND field_name = :field_name AND cookie = :cookie AND field_name_delta=:field_name_delta",
-          array(':nid'=>$t_nid, ':field_table'=>$field_table, ':field_name'=>$field_name, ':cookie'=>$cookie_compare_db, ':field_name_delta'=>$field_name_delta));
+          array(':nid'=>$t_nid, ':field_table'=>$field_table, ':field_name'=>$field_name, ':cookie'=>$cookie_compare_db, ':field_name_delta'=>$field_name_delta))->fetchField();
       }
     }
     $is_voted=$is_voted+$voted;
@@ -951,6 +927,7 @@ function pollfield_duration_options() {
   $duration_options = array(0 => t('Unlimited')) + drupal_map_assoc(array(86400, 172800, 345600, 604800, 1209600, 2419200, 4838400, 9676800, 31536000), "format_interval");
   return $duration_options;
 }
+
 /**
  * Internal callback to validate starting vote totals.
  *
@@ -980,30 +957,24 @@ function pollfield_init() {
  */
 function theme_pollfield_default_formatter($elements){
 	 // Node object
-	
   $node = $elements['elements']['entity'];
 	$delta = $elements['elements']['delta'];
+  
   // Get the available choices for this poll
   $choices = unserialize($elements['elements']['item']['choice']);
 	$item = $elements['elements']['item'];
-
-
   $output = '';
   if (!empty($choices)) {
-
     $pollfield_title = check_plain($elements['elements']['item']['question']);
     $poll_result = pollfield_build_results($elements['elements']);
 		
-    // Build voting form
-   
-		
+		// Build voting form 
     $form = drupal_get_form('pollfield_voting_form', $elements['elements']);
-	
+
     $output  = '<div id="pollfield">';
     $output .= '<div id="pollfield-'. $node->nid .'-'. $delta .'" class="pollfield-form">';
     $output .= '<div class="pollfield-title">'. $pollfield_title .'</div>';
     $output .= $poll_result;
-		
     $output .= render($form);
     $output .= '</div>';
     $output .= '</div>';
@@ -1037,10 +1008,10 @@ function pollfield_voting_form($form, &$form_state,$elements) {
     else {
       $poll_features = unserialize($elements['item']['poll_features']);
     }
-		
+
     // Get anonymous vote settings
     $anonymous = $elements['item']['anonymous'];
-		
+    	
     // Check if user has voted
     $voted = pollfield_user_voted($elements);
 		
@@ -1067,11 +1038,6 @@ function pollfield_voting_form($form, &$form_state,$elements) {
 
     // If the user hasn't voted, build the vote form
     else {
-      if ($user->uid == 0) {
-        if ($anonymous == 'anon_non') {
-          return NULL;
-        }
-      }
       if ($items) {
         $list = array();
         $choices = unserialize($items['choice']);
@@ -1093,7 +1059,14 @@ function pollfield_voting_form($form, &$form_state,$elements) {
         }
       }
       $cancel = 0;
-      $form = array_merge($form, pollfield_voting_form_data($field_name_delta, $field_name, $node->nid, $table, $cancel,$items));
+      if (($user->uid == 0 || !isset($user->uid)) && ($anonymous == 'anon_non' || $anonymous == 'anon_by_cookie')) {
+        $form['title'] = array(
+          '#markup' => '<em>Please note you need to be logged in to vote on this poll</em>',
+        );
+      }
+      else {
+        $form = array_merge($form, pollfield_voting_form_data($field_name_delta, $field_name, $node->nid, $table, $cancel, $items));
+      }
     }
 		
     return $form;
@@ -1186,13 +1159,10 @@ function pollfield_build_results($elements) {
       // this node allows results viewing, show them.
       $permission='view pollfield results '. $field_name;
       if (user_access($permission)) {
-      	
         if ( $user_voted || pollfield_display_results_before_vote($elements['item'])) {
-          
 					$variables['choice']=$choice;$variables['percent']=$percent;
 					$variables['percent_string']=$percent_string;$variables['user_choice']=$user_choice;
 					$variables['show_results']=TRUE;
-					
 					$poll_result .= theme('pollfield_row', $variables);
         }
       }
@@ -1249,6 +1219,7 @@ function pollfield_sum_starting_votes($choices) {
     return $total_votes;
   }
 }
+
 /**
  * Does this node allow the user to view results?
  *
@@ -1266,31 +1237,24 @@ function pollfield_display_results_before_vote($item) {
   }
   return FALSE;
 }
+
 /**
  * choices field formatter function
  */
 function theme_pollfield_choices_formatter($item,$entity){
 	// Node object
-   // Node object
-	
   $node = $elements['elements']['entity'];
 	$delta = $elements['elements']['delta'];
+  
   // Get the available choices for this poll
   $choices = unserialize($elements['elements']['item']['choice']);
-	
-	
-	
   $output = '';
   if (!empty($choices)) {
-
     $pollfield_title = check_plain($elements['elements']['item']['question']);
     $poll_result = pollfield_build_results($elements['elements']);
 		
     // Build voting form
-   
-		
     $form = drupal_get_form('pollfield_voting_form', $elements['elements']);
-	
     $output  = '<div id="pollfield">';
     $output .= '<div id="pollfield-'. $node->nid .'-'. $delta .'" class="pollfield-form">';
     $output .= '<div class="pollfield-title">'. $pollfield_title .'</div>';
@@ -1299,30 +1263,24 @@ function theme_pollfield_choices_formatter($item,$entity){
   }
   return $output;
 }
+
 /**
  * results field formatter function
  */
 function theme_pollfield_results_formatter($item,$entity){
 	 // Node object
-	
   $node = $elements['elements']['entity'];
 	$delta = $elements['elements']['delta'];
+  
   // Get the available choices for this poll
   $choices = unserialize($elements['elements']['item']['choice']);
-	
-	
-	
   $output = '';
   if (!empty($choices)) {
-
     $pollfield_title = check_plain($elements['elements']['item']['question']);
     $poll_result = pollfield_build_results($elements['elements']);
 		
     // Build voting form
-   
-		
     $form = drupal_get_form('pollfield_voting_form', $elements['elements']);
-	
     $output  = '<div id="pollfield">';
     $output .= '<div id="pollfield-'. $node->nid .'-'. $delta .'" class="pollfield-form">';
     $output .= '<div class="pollfield-title">'. $pollfield_title .'</div>';
@@ -1332,20 +1290,18 @@ function theme_pollfield_results_formatter($item,$entity){
   }
   return $output;
 }
+
 /**
  * runtime field formatter function
  */
 function theme_pollfield_runtime_formatter($item,$entity){
-	 $node = $elements['elements']['entity'];
+	$node = $elements['elements']['entity'];
 	$delta = $elements['elements']['delta'];
+  
   // Get the available choices for this poll
-  $choices = unserialize($elements['elements']['item']['choice']);
-	
-	
-	
+  $choices = unserialize($elements['elements']['item']['choice']);	
   $output = '';
   if (!empty($choices)) {
-
     if ($elements['elements']['item']['runtime']>0) {
       $runtime = t('!duration duration of poll in seconds', array('!duration' => $elements['elements']['item']['runtime']));
     }
@@ -1354,38 +1310,30 @@ function theme_pollfield_runtime_formatter($item,$entity){
     }
     $out = '<div class="pollfield-runtime">'. check_plain($runtime) .'</div>';
     return $out;
-
   }
   return $output;
 }
+
 /**
  * question field formatter function
  */
 function theme_pollfield_question_formatter($item,$entity){
-	 $node = $elements['elements']['entity'];
+	$node = $elements['elements']['entity'];
 	$delta = $elements['elements']['delta'];
   // Get the available choices for this poll
   $choices = unserialize($elements['elements']['item']['choice']);
 	
-	
-	
   $output = '';
   if (!empty($choices)) {
-
-    
-		
     $output = '<div class="pollfield-questions">';
-
     if ($elements['elements']['item']['question']!="' '") {
       $output .= '<div class="pollfield-row">'. check_plain($elements['elements']['item']['question']) .'</div>';
     }
     $output .= '</div>';
-
-   
- 
   }
   return $output;
 }
+
 /**
  * Implementation of hook_theme().
  *
@@ -1395,7 +1343,6 @@ function theme_pollfield_question_formatter($item,$entity){
  * in the CCK display settings for this field.
  */
 function pollfield_theme() {
-
   return array(    
     'pollfield_default_formatter' => array(
       'variables' => array('elements'),
@@ -1417,6 +1364,7 @@ function pollfield_theme() {
     ),
   );
 }
+
 /**
  * Theme function for an single results row.
  *
@@ -1437,7 +1385,6 @@ function pollfield_theme() {
  *   Formatted HTML string of one choice result in a pollfield
  */
 function theme_pollfield_row($variables) {
- 
   // Mark the user's vote
   $row_class='';
   if ($variables['user_choice']) {
@@ -1454,6 +1401,7 @@ function theme_pollfield_row($variables) {
   $output .= '</div>';
   return $output;
 }
+
 /**
  * Implementation of hook_perm().
  *
@@ -1461,7 +1409,6 @@ function theme_pollfield_row($variables) {
  */
 function pollfield_permission() {
   // Get CCK fields
-  
   $fields_query = db_query("SELECT field_name FROM {field_config} WHERE type='pollfield_poll'");
 	// Build a permission for each pollfield enabled content type
   $permission = array();
@@ -1470,9 +1417,7 @@ function pollfield_permission() {
 		$admin_pollfield = 'admin pollfield '. $field_name;
 		$permission[$view_result]=array('title'=>$field_name.t(' - View pollfield results ').$field_name);
     $permission[$admin_pollfield]=array('title'=>$field_name.t(' - Full admin access to pollfield edit options '));
-		
 	}
-	
   return $permission;
 }
 
@@ -1489,7 +1434,6 @@ function pollfield_clear($node) {
   cache_clear_all();
 }
 
-
 /**
  * Implementation of hook_cron().
  * Closes pollfields that have exceeded their allowed runtime.
@@ -1507,5 +1451,4 @@ function pollfield_cron() {
 			db_query($query_update);
 		}
 	}
-  
-}
+}
\ No newline at end of file
