diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ModelElementFinder.java b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ModelElementFinder.java
index f71e484..bf24be1 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ModelElementFinder.java
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/scoping/ModelElementFinder.java
@@ -51,19 +51,20 @@
   @Inject private Resources resources;
   @Inject private ResourceSets resourceSets;
 
+  // Start at an element
   <T> Collection<IEObjectDescription> find(EObject start, FinderStrategy<T> strategy, T criteria) {
     Set<IEObjectDescription> descriptions = newHashSet();
-    descriptions.addAll(local(start, strategy, criteria));
+    descriptions.addAll(getDescriptionsFromObjectAncestors(start, strategy, criteria));
     Protobuf root = modelObjects.rootOf(start);
-    descriptions.addAll(imported(root, strategy, criteria));
+    descriptions.addAll(getDescriptionsFromAllImports(root, strategy, criteria));
     return unmodifiableSet(descriptions);
   }
 
-  private <T> Collection<IEObjectDescription> local(EObject start, FinderStrategy<T> strategy, T criteria) {
+  private <T> Collection<IEObjectDescription> getDescriptionsFromObjectAncestors(EObject start, FinderStrategy<T> strategy, T criteria) {
     UniqueDescriptions descriptions = new UniqueDescriptions();
     EObject current = start.eContainer();
     while (current != null) {
-      descriptions.addAll(local(current, strategy, criteria, 0));
+      descriptions.addAll(getDescriptionsFromObjectDescendants(current, strategy, criteria, 0));
       current = current.eContainer();
     }
     return descriptions.values();
@@ -71,32 +72,32 @@
 
   <T> Collection<IEObjectDescription> find(Protobuf start, FinderStrategy<T> strategy, T criteria) {
     Set<IEObjectDescription> descriptions = newHashSet();
-    descriptions.addAll(local(start, strategy, criteria, 0));
-    descriptions.addAll(imported(start, strategy, criteria));
+    descriptions.addAll(getDescriptionsFromObjectDescendants(start, strategy, criteria, 0));
+    descriptions.addAll(getDescriptionsFromAllImports(start, strategy, criteria));
     return unmodifiableSet(descriptions);
   }
 
-  private <T> Collection<IEObjectDescription> local(EObject start, FinderStrategy<T> strategy, T criteria, int level) {
+  private <T> Collection<IEObjectDescription> getDescriptionsFromObjectDescendants(EObject start, FinderStrategy<T> strategy, T criteria, int level) {
     UniqueDescriptions descriptions = new UniqueDescriptions();
     for (EObject element : start.eContents()) {
       descriptions.addAll(strategy.local(element, criteria, level));
       if (element instanceof Message || element instanceof Group) {
-        descriptions.addAll(local(element, strategy, criteria, level + 1));
+        descriptions.addAll(getDescriptionsFromObjectDescendants(element, strategy, criteria, level + 1));
       }
     }
     return descriptions.values();
   }
 
-  private <T> Collection<IEObjectDescription> imported(Protobuf start, FinderStrategy<T> strategy, T criteria) {
+  private <T> Collection<IEObjectDescription> getDescriptionsFromAllImports(Protobuf start, FinderStrategy<T> strategy, T criteria) {
     List<Import> allImports = protobufs.importsIn(start);
     if (allImports.isEmpty()) {
       return emptyList();
     }
     ResourceSet resourceSet = start.eResource().getResourceSet();
-    return imported(allImports, modelObjects.packageOf(start), resourceSet, strategy, criteria);
+    return getDescriptionsFromImports(allImports, modelObjects.packageOf(start), resourceSet, strategy, criteria);
   }
 
-  private <T> Collection<IEObjectDescription> imported(List<Import> allImports, Package fromImporter,
+  private <T> Collection<IEObjectDescription> getDescriptionsFromImports(List<Import> allImports, Package fromImporter,
       ResourceSet resourceSet, FinderStrategy<T> strategy, T criteria) {
     Set<IEObjectDescription> descriptions = newHashSet();
     for (Import anImport : allImports) {
@@ -117,19 +118,23 @@
         continue;
       }
       if (rootOfImported != null) {
-        descriptions.addAll(publicImported(rootOfImported, strategy, criteria));
+        descriptions.addAll(getDescriptionsFromPublicImports(rootOfImported, strategy, criteria));
         if (arePackagesRelated(fromImporter, rootOfImported)) {
-          descriptions.addAll(local(rootOfImported, strategy, criteria, 0));
+          descriptions.addAll(getDescriptionsFromObjectDescendants(rootOfImported, strategy, criteria, 0));
           continue;
         }
         Package packageOfImported = modelObjects.packageOf(rootOfImported);
-        descriptions.addAll(imported(fromImporter, packageOfImported, imported, strategy, criteria));
+        TreeIterator<Object> contents = getAllContents(imported, true);
+        while (contents.hasNext()) {
+          Object next = contents.next();
+          descriptions.addAll(strategy.imported(fromImporter, packageOfImported, next, criteria));
+        }
       }
     }
     return descriptions;
   }
 
-  private <T> Collection<IEObjectDescription> publicImported(Protobuf start, FinderStrategy<T> strategy, T criteria) {
+  private <T> Collection<IEObjectDescription> getDescriptionsFromPublicImports(Protobuf start, FinderStrategy<T> strategy, T criteria) {
     if (!protobufs.hasKnownSyntax(start)) {
       return emptySet();
     }
@@ -138,7 +143,7 @@
       return emptyList();
     }
     ResourceSet resourceSet = start.eResource().getResourceSet();
-    return imported(allImports, modelObjects.packageOf(start), resourceSet, strategy, criteria);
+    return getDescriptionsFromImports(allImports, modelObjects.packageOf(start), resourceSet, strategy, criteria);
   }
 
   private boolean arePackagesRelated(Package aPackage, EObject root) {
@@ -146,17 +151,6 @@
     return packages.areRelated(aPackage, p);
   }
 
-  private <T> Collection<IEObjectDescription> imported(Package fromImporter, Package fromImported, Resource resource,
-      FinderStrategy<T> strategy, T criteria) {
-    Set<IEObjectDescription> descriptions = newHashSet();
-    TreeIterator<Object> contents = getAllContents(resource, true);
-    while (contents.hasNext()) {
-      Object next = contents.next();
-      descriptions.addAll(strategy.imported(fromImporter, fromImported, next, criteria));
-    }
-    return descriptions;
-  }
-
   static interface FinderStrategy<T> {
     Collection<IEObjectDescription> imported(Package fromImporter, Package fromImported, Object target, T criteria);
 
