diff --git a/modules/ai_image_bulk_alt_text/src/Form/AltTextFixer.php b/modules/ai_image_bulk_alt_text/src/Form/AltTextFixer.php
index e122ee6..0d41393 100644
--- a/modules/ai_image_bulk_alt_text/src/Form/AltTextFixer.php
+++ b/modules/ai_image_bulk_alt_text/src/Form/AltTextFixer.php
@@ -226,33 +226,62 @@ class AltTextFixer extends FormBase {
   protected function getEntitiesAndFields($limit = 50) {
     $entity_types = $this->getImageFields();
     $missing_alt_text = [];
-    $i = 0;
+    $count = 0;
+    
     foreach ($entity_types as $table => $field) {
-      // Load all entities with this field.
-      foreach ($this->entityTypeManager->getStorage($field['entity_type'])->loadMultiple() as $entity) {
-        // Iterate over the field values.
+      // Query the database directly to find entities with missing alt text
+      $query = $this->database->select($table, 'f');
+      $query->fields('f', ['entity_id', $field['field'] . '_target_id']);
+      $query->condition('f.' . $field['field'] . '_alt', '', '=');
+      $query->condition('f.' . $field['field'] . '_target_id', 0, '>');
+      $query->range(0, $limit - $count);
+      
+      $results = $query->execute()->fetchAll();
+      
+      foreach ($results as $result) {
+        // Load the specific entity
+        $entity = $this->entityTypeManager->getStorage($field['entity_type'])->load($result->entity_id);
+        if (!$entity) {
+          continue;
+        }
+        
+        // Load the file entity
+        $file_id = $result->{$field['field'] . '_target_id'};
+        $file = $this->entityTypeManager->getStorage('file')->load($file_id);
+        if (!$file) {
+          continue;
+        }
+        
+        // Find the specific field item
+        $field_item = NULL;
         if (!empty($entity->{$field['field']})) {
           foreach ($entity->{$field['field']} as $item) {
-            // Check if the alt text is empty.
-            if (empty($entity->{$field['field']}->alt) && !empty($item->entity)) {
-              $missing_alt_text[] = [
-                'entity' => $item->entity,
-                'field' => $field['field'],
-                'type' => $field['entity_type'],
-                'base_entity' => $entity,
-                'bundle' => $field['bundle'],
-                'item' => $item,
-                'unique_id' => md5($entity->id() . '-' . $field['field'] . '-' . $item->target_id),
-              ];
-              $i++;
-              if ($i == $limit) {
-                return $missing_alt_text;
-              }
+            if ($item->target_id == $file_id && empty($item->alt)) {
+              $field_item = $item;
+              break;
             }
           }
         }
+        
+        if ($field_item) {
+          $missing_alt_text[] = [
+            'entity' => $file,
+            'field' => $field['field'],
+            'type' => $field['entity_type'],
+            'base_entity' => $entity,
+            'bundle' => $field['bundle'],
+            'item' => $field_item,
+            'unique_id' => md5($entity->id() . '-' . $field['field'] . '-' . $file_id),
+          ];
+          $count++;
+          
+          if ($count >= $limit) {
+            return $missing_alt_text;
+          }
+        }
       }
     }
+    
     return $missing_alt_text;
   }
 
