diff --git a/entityreference_count.module b/entityreference_count.module
index 2bc9359..d1b2c99 100644
--- a/entityreference_count.module
+++ b/entityreference_count.module
@@ -31,10 +31,15 @@ function entityreference_count_field_info() {
 function entityreference_count_field_instance_settings_form($field, $instance) {
   $settings = $instance['settings'];
   $form = array();
+  $entity_type = $instance['entity_type'];
 
+  // Get a list of all suitable entity reference fields that point to this
+  // entity type.
   $er_fields = array();
-  foreach (field_read_fields(array('type' => 'entityreference', 'entity_type' => $instance['entity_type'])) as $field_name => $field_info) {
-    $er_fields[$field_name] = $field_name;
+  foreach (field_read_fields(array('type' => 'entityreference')) as $field_name => $field_info) {
+    if ($entity_type == $field_info['settings']['target_type']) {
+      $er_fields[$field_name] = $field_info;
+    }
   }
 
   if (empty($er_fields)) {
@@ -51,30 +56,13 @@ function entityreference_count_field_instance_settings_form($field, $instance) {
       '#description' => t('Select the entity reference fields that you would like to count.'),
       '#multiple' => TRUE,
       '#default_value' => $settings['counted_reference_fields'],
-      '#options' => $er_fields,
+      '#options' => drupal_map_assoc(array_keys($er_fields)),
     );
-    $bundles_list = field_info_bundles($instance['entity_type']);
-    $bundles = array();
-    if ($bundles_list) {
-      foreach ($bundles_list as $bkey => $data) {
-        $bundles[$bkey] = $data['label'];
-      }
-    }
-    if ($instance['entity_type'] == 'node') {
-      $form['count_only_published'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Do not count references from unpublished nodes.'),
-        '#default_value' => $settings['count_only_published'],
-      );
-    }
-    $form['allowed_bundles'] = array(
-      '#type' => 'select',
-      '#title' => t('Count references that belong to these bundles:'),
-      '#description' => t('If no bundles are selected, all bundles will be counted.'),
-      '#options' => $bundles,
-      '#multiple' => TRUE,
-      '#default_value' => !empty($settings['allowed_bundles']) ? array_filter($settings['allowed_bundles']) : array(),
-      '#size' => max(4, count($bundles)),
+    $form['count_only_published'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Do not count references from unpublished nodes.'),
+      '#description' => t('Only relevant for reference fields that are on nodes.'),
+      '#default_value' => $settings['count_only_published'],
     );
   }
 
@@ -311,6 +299,7 @@ function entityreference_count_field_presave($entity_type, $entity, $field, $ins
  *
  * @param $field_names
  *   An array of field names.
+ *
  * @return
  *   An indexed array of table and column names.
  */
@@ -345,61 +334,43 @@ function entityreference_count_get_fields_db($field_names) {
  *   The type of entity being referenced
  * @param $entity
  *   The entity being referenced.
+ *
  * @return
  *   A count of the number of references to the entity
  */
 function entityreference_count_get_count($settings, $entity_type, $entity) {
-
-  // Get the db info for the entityreference fields.
-  $db = entityreference_count_get_fields_db($settings['counted_reference_fields']);
-
-  // Get the entity info.
-  $entity_info = entity_get_info($entity_type);
-
-  // if not defined the base table and entity key id omit the count.
-  if (empty($entity_info['base table']) && empty($entity_info['entity keys']['id'])) {
-    return;
+  // Get the entity's info.
+  list($entity_id, $revision_id, $bundle) = entity_extract_ids($entity_type, $entity);
+
+  // The field name that'll be used.
+  $field_name = reset($settings['counted_reference_fields']);
+
+  // The field's main settings.
+  $field = field_read_fields(array('field_name' => $field_name));
+  $field = reset($field);
+  $ref_entity_type = $field['settings']['target_type'];
+
+  // The field instance settings.
+  // $instance = field_read_instances(array('field_name' => $field_name));
+  // $instance = reset($instance);
+
+  // @todo Should this support multiple fields?
+  $query = new EntityFieldQuery();
+  // $query->entityCondition('entity_type', $dest_entity_type);
+  if ($entity_type == 'node' && !empty($settings['count_only_published'])) {
+    $query->condition('status', 1);
   }
-
-  if (!empty($db) && isset($entity->{$entity_info['entity keys']['id']})) {
-    $base_table = $entity_info['base table'];
-    $entity_key_id = $entity_info['entity keys']['id'];
-
-    $query = db_select($base_table, 'e');
-    $query->fields('e', array($entity_key_id));
-    $alias = $query->innerJoin($db[0]['table'], 'er', '%alias.entity_id = e.' . $entity_key_id);
-    $query->condition("{$alias}.{$db[0]['column']}", $entity->{$entity_key_id});
-    if ($entity_type == 'node' && $settings['count_only_published']) {
-      $query->condition('e.status', NODE_PUBLISHED);
-    }
-    if (!empty($settings['allowed_bundles'])) {
-      $query->condition('er.bundle', array_keys($settings['allowed_bundles']), 'IN');
-    }
-
-    unset($db[0]);
-
-    // Add each additional field to the query via a UNION ALL.
-    foreach ($db as $d) {
-      $select = db_select($base_table, 'e');
-      $select->fields('e', array($entity_key_id));
-      $alias = $select->innerJoin($d['table'], 'er', '%alias.entity_id = e.' . $entity_key_id);
-      $select->condition("{$alias}.{$d['column']}", $entity->{$entity_key_id});
-      if ($entity_type == 'node' && $settings['count_only_published']) {
-        $select->condition('e.status', NODE_PUBLISHED);
-      }
-      if (!empty($settings['allowed_bundles'])) {
-        $query->condition('er.bundle', array_keys($settings['allowed_bundles']), 'IN');
-      }
-
-      $query->union($select, 'UNION ALL');
-    }
-
-    $query->addTag('entityreference_count');
-
-    return $query->countQuery()->execute()->fetchField();
+  $query->fieldCondition($field_name, 'target_id', $entity_id);
+  $results = $query->execute();
+
+  // Work out how many records there are. The return from EFQ will be a nested
+  // array.
+  $count = 0;
+  if (!empty($results)) {
+    $count = count(reset($results));
   }
 
-  return 0;
+  return $count;
 }
 
 /**
@@ -444,6 +415,7 @@ function entityreference_count_entity_delete($entity, $entity_type) {
  *   The entity type
  * @param $entity_references
  *   An array of entity reference fields.
+ *
  * @return
  *   An array of field names.
  */
@@ -476,6 +448,7 @@ function entityreference_count_get_counted_entityreference_fields($entity_type,
  *   The entity object.
  * @param $counted_fields
  *   An array of entity reference fields.
+ *
  * @return
  *   An array of target_ids.
  */
@@ -521,22 +494,28 @@ function entityreference_count_get_referenced_ids($entity, $counted_fields) {
  *   implementation above for more info.
  */
 function entityreference_count_references_update($entity_type, $entity, $delay = FALSE) {
-  if (!$entity_type || !isset($entity->type)) {
+  if (!$entity_type || !isset($entity)) {
     return;
   }
 
+  // Get the entity's info.
+  list($entity_id, $revision_id, $bundle) = entity_extract_ids($entity_type, $entity);
+
   // Get all the entity reference fields for this content type.
-  $entityreference_fields = field_read_fields(array('type' => 'entityreference', 'entity_type' => $entity_type, 'bundle' => $entity->type));
+  $entityreference_fields = field_read_fields(array('type' => 'entityreference', 'entity_type' => $entity_type, 'bundle' => $bundle));
 
-  // If there are no entity references for this content type then there is nothing to count.
+  // If there are no entity references for this content type then there is
+  // nothing to count.
   if (empty($entityreference_fields)) {
     return;
   }
 
-  // Get all the entity reference fields for this content type that are counted by a entityreference count field.
+  // Get all the entity reference fields for this content type that are counted
+  // by a entityreference count field.
   $counted_fields = entityreference_count_get_counted_entityreference_fields($entity_type, $entityreference_fields);
 
-  // If there are no entity references being counted for this content type then there is nothing to count.
+  // If there are no entity references being counted for this content type then
+  // there is nothing to count.
   if (empty($counted_fields)) {
     return;
   }
@@ -592,6 +571,7 @@ function entityreference_count_entityreference_count_updated($entity_type, $enti
  *
  * @param $entity_id
  *   A entity_id that should be added to the cache.
+ *
  * @return
  *   An array of entity_ids.
  */
