diff --git a/apachesolr.index.inc b/apachesolr.index.inc
index c1edba7..1952327 100644
--- a/apachesolr.index.inc
+++ b/apachesolr.index.inc
@@ -150,7 +150,7 @@ function apachesolr_index_index_entity($item, $env_id) {
   // @todo Uncomment these lines when we're done debugging, since they break dpm().
   $user = $saved_user;
   drupal_save_session(TRUE);
-
+  
   return $documents;
 
 }
@@ -772,10 +772,84 @@ function apachesolr_vocab_name($vid) {
 }
 
 /**
+ * Construct a dynamic index name based on information about a field.
+ *
+ * array('index_type' => 'integer',
+ *        'multiple' => TRUE,
+ *        'name' => 'fieldname',
+ *        ),
+ */
+function apachesolr_index_key($field) {
+  $index_type = !empty($field['index_type']) ? $field['index_type'] : NULL;
+  switch ($index_type) {
+    case 'text':
+      $type_prefix = 't';
+      break;
+    case 'text-omitNorms':
+      $type_prefix = 'to';
+      break;
+    case 'text-edgeNgram':
+      $type_prefix = 'te';
+      break;
+    case 'text-whiteSpace':
+      $type_prefix = 'tw';
+      break;
+    case 'integer':
+      $type_prefix = 'i'; // long integer
+      break;
+    case 'half-int':
+      $type_prefix = 'h'; // 32 bit integer
+      break;
+    case 'float':
+      $type_prefix = 'f'; // float; sortable.
+      break;
+    case 'double':
+      $type_prefix = 'p'; // double; sortable d was used for date.
+      break;
+    case 'sint':
+      $type_prefix = 'is'; // long integer sortable (deprecated)
+      break;
+    case 'boolean':
+      $type_prefix = 'b';
+      break;
+    case 'date':
+      $type_prefix = 'd'; // date trie
+      break;
+    case 'tint':
+      $type_prefix = 'it'; // long integer trie; sortable, best for range queries
+      break;
+    case 'thalf-int':
+      $type_prefix = 'ht'; // 32 bit integer trie (sortable)
+      break;
+    case 'tfloat':
+      $type_prefix = 'ft'; // float trie; sortable, best for range queries.
+      break;
+    case 'tdouble':
+      $type_prefix = 'pt'; // double trie; d was used for date.
+      break;
+    case 'sfloat':
+      $type_prefix = 'fs'; // float, sortable (use for sorting missing last).
+      break;
+    case 'sdouble':
+      $type_prefix = 'ps'; // double sortable; (use for sorting missing last).
+      break;
+    case 'string':
+    default:
+      $type_prefix = 's'; // String
+  }
+  $sm = !empty($field['multiple']) ? 'm_' : 's_';
+  // Block deltas are limited to 32 chars.
+  return substr($type_prefix . $sm . $field['name'], 0, 32);
+}
+
+/**
  * Callback that converts list module field into an array
+ * For every multivalued value we also add a single value to be able to
+ * use the stats
  */
 function apachesolr_fields_default_indexing_callback($entity, $field_name, $index_key, $field_info) {
   $fields = array();
+  $numeric = TRUE;
   if (!empty($entity->{$field_name})) {
     $field = $entity->$field_name;
     list($lang, $values) = each($field);
@@ -797,13 +871,25 @@ function apachesolr_fields_default_indexing_callback($entity, $field_name, $inde
         $function = 'apachesolr_floatval';
         break;
       default:
+        $numeric = FALSE;
         $function = 'apachesolr_clean_text';
     }
-    foreach ($values as $fval) {
+    for($i = 0; $i < count($values); $i++) {
       $fields[] = array(
         'key' => $index_key,
-        'value' => $function($fval['value']),
+        'value' => $function($values[$i]['value']),
       );
+
+      // Only store the first value of the field in a singular index
+      if ($numeric && ($i == 0)) {
+        $singular_field_info = $field_info;
+        $singular_field_info['multiple'] = FALSE;
+        $single_key = apachesolr_index_key($singular_field_info);
+        $fields[] = array(
+          'key' => $single_key,
+          'value' => $function($values[$i]['value']),
+        );
+      }
     }
   }
   return $fields;
diff --git a/apachesolr.module b/apachesolr.module
index d58bdca..7e58185 100644
--- a/apachesolr.module
+++ b/apachesolr.module
@@ -1362,77 +1362,6 @@ function apachesolr_current_query($env_id, DrupalSolrQueryInterface $query = NUL
 }
 
 /**
- * Construct a dynamic index name based on information about a field.
- *
- * array('index_type' => 'integer',
- *        'multiple' => TRUE,
- *        'name' => 'fieldname',
- *        ),
- */
-function apachesolr_index_key($field) {
-  $index_type = !empty($field['index_type']) ? $field['index_type'] : NULL;
-  switch ($index_type) {
-    case 'text':
-      $type_prefix = 't';
-      break;
-    case 'text-omitNorms':
-      $type_prefix = 'to';
-      break;
-    case 'text-edgeNgram':
-      $type_prefix = 'te';
-      break;
-    case 'text-whiteSpace':
-      $type_prefix = 'tw';
-      break;
-    case 'integer':
-      $type_prefix = 'i'; // long integer
-      break;
-    case 'half-int':
-      $type_prefix = 'h'; // 32 bit integer
-      break;
-    case 'float':
-      $type_prefix = 'f'; // float; sortable.
-      break;
-    case 'double':
-      $type_prefix = 'p'; // double; sortable d was used for date.
-      break;
-    case 'sint':
-      $type_prefix = 'is'; // long integer sortable (deprecated)
-      break;
-    case 'boolean':
-      $type_prefix = 'b';
-      break;
-    case 'date':
-      $type_prefix = 'd'; // date trie
-      break;
-    case 'tint':
-      $type_prefix = 'it'; // long integer trie; sortable, best for range queries
-      break;
-    case 'thalf-int':
-      $type_prefix = 'ht'; // 32 bit integer trie (sortable)
-      break;
-    case 'tfloat':
-      $type_prefix = 'ft'; // float trie; sortable, best for range queries.
-      break;
-    case 'tdouble':
-      $type_prefix = 'pt'; // double trie; d was used for date.
-      break;
-    case 'sfloat':
-      $type_prefix = 'fs'; // float, sortable (use for sorting missing last).
-      break;
-    case 'sdouble':
-      $type_prefix = 'ps'; // double sortable; (use for sorting missing last).
-      break;
-    case 'string':
-    default:
-      $type_prefix = 's'; // String
-  }
-  $sm = !empty($field['multiple']) ? 'm_' : 's_';
-  // Block deltas are limited to 32 chars.
-  return substr($type_prefix . $sm . $field['name'], 0, 32);
-}
-
-/**
  * Try to map a schema field name to a human-readable description.
  */
 function apachesolr_field_name_map($field_name) {
@@ -1490,6 +1419,7 @@ function apachesolr_facet_form_validate($form, &$form_state) {
  */
 function apachesolr_entity_info_alter(&$entity_info) {
   module_load_include('inc', 'apachesolr', 'apachesolr.index');
+  $env_id = apachesolr_default_environment();
   // Set those values that we know.  Other modules can do so
   // for their own entities if they want.
   $default_entity_info = array();
@@ -1524,7 +1454,7 @@ function apachesolr_entity_info_alter(&$entity_info) {
   // For any supported entity type and bundle, flag it for indexing.
   foreach ($entity_info as $entity_type => $info) {
     if ($info['apachesolr']['indexable']) {
-      $supported = apachesolr_index_get_bundles('default', $entity_type);
+      $supported = apachesolr_index_get_bundles($env_id, $entity_type);
       foreach (array_keys($info['bundles']) as $bundle) {
         if (in_array($bundle, $supported)) {
           $entity_info[$entity_type]['bundles'][$bundle]['apachesolr']['index'] = TRUE;
@@ -1546,6 +1476,7 @@ function apachesolr_entity_insert($entity, $type) {
  * Implements hook_entity_update().
  */
 function apachesolr_entity_update($entity, $type) {
+  $should = apachesolr_entity_should_index($entity, $type);
   if (apachesolr_entity_should_index($entity, $type)) {
     $info = entity_get_info($type);
     list($id, $vid, $bundle) = entity_extract_ids($type, $entity);
@@ -1621,6 +1552,7 @@ function apachesolr_entity_fields($entity_type = 'node') {
 
     // Allow other modules to add or alter mappings.
     drupal_alter('apachesolr_field_mappings', $mappings, $entity_type);
+
     $modules = system_get_info('module');
     $instances = field_info_instances($entity_type);
     foreach (field_info_fields() as $field_name => $field) {
