diff --git a/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java b/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
index 6b727f0..5829b79 100644
--- a/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/ModuleImpl.java
@@ -49,6 +49,8 @@
 import org.apache.felix.framework.capabilityset.Requirement;
 import org.apache.felix.framework.capabilityset.SimpleFilter;
 import org.apache.felix.framework.resolver.Content;
+import org.apache.felix.framework.resolver.HostedCapability;
+import org.apache.felix.framework.resolver.HostedRequirement;
 import org.apache.felix.framework.resolver.Module;
 import org.apache.felix.framework.resolver.ResolveException;
 import org.apache.felix.framework.resolver.ResourceNotFoundException;
@@ -60,7 +62,6 @@
 import org.apache.felix.framework.util.SecureAction;
 import org.apache.felix.framework.util.SecurityManagerEx;
 import org.apache.felix.framework.util.Util;
-import org.apache.felix.framework.util.manifestparser.CapabilityImpl;
 import org.apache.felix.framework.util.manifestparser.ManifestParser;
 import org.apache.felix.framework.util.manifestparser.R4Library;
 import org.apache.felix.framework.util.manifestparser.RequirementImpl;
@@ -312,11 +313,7 @@
                     if (caps.get(capIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE))
                     {
                         capList.add(
-                            new CapabilityImpl(
-                                this,
-                                caps.get(capIdx).getNamespace(),
-                                caps.get(capIdx).getDirectives(),
-                                caps.get(capIdx).getAttributes()));
+                            new HostedCapability(this, caps.get(capIdx)));
                     }
                 }
             }
@@ -344,8 +341,7 @@
                         || reqs.get(reqIdx).getNamespace().equals(Capability.MODULE_NAMESPACE))
                     {
                         reqList.add(
-                            new FragmentRequirement(
-                                this, reqs.get(reqIdx)));
+                            new HostedRequirement(this, reqs.get(reqIdx)));
                     }
                 }
             }
@@ -403,7 +399,7 @@
             // We need to return null here if we don't have any libraries, since a
             // zero-length array is used to indicate that matching native libraries
             // could not be found when resolving the bundle.
-            result = (nativeList.size() == 0)
+            result = (nativeList.isEmpty())
                 ? null
                 : Collections.unmodifiableList(nativeList);
         }
@@ -2438,56 +2434,4 @@
 
         return sb.toString();
     }
-
-    static class FragmentRequirement implements Requirement
-    {
-        private final Module m_owner;
-        private final Requirement m_fragmentReq;
-
-        public FragmentRequirement(Module owner, Requirement fragmentReq)
-        {
-            m_owner = owner;
-            m_fragmentReq = fragmentReq;
-        }
-
-        public Module getFragment()
-        {
-            return m_fragmentReq.getModule();
-        }
-
-        public Module getModule()
-        {
-            return m_owner;
-        }
-
-        public String getNamespace()
-        {
-            return m_fragmentReq.getNamespace();
-        }
-
-        public SimpleFilter getFilter()
-        {
-            return m_fragmentReq.getFilter();
-        }
-
-        public boolean isOptional()
-        {
-            return m_fragmentReq.isOptional();
-        }
-
-        public Directive getDirective(String name)
-        {
-            return m_fragmentReq.getDirective(name);
-        }
-
-        public List<Directive> getDirectives()
-        {
-            return m_fragmentReq.getDirectives();
-        }
-
-        public String toString()
-        {
-            return m_fragmentReq.toString();
-        }
-    }
 }
\ No newline at end of file
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
index efd7ff3..ac95e7d 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
@@ -55,7 +55,7 @@
     private final Map<Capability, Map<String, Map<Version, List<Requirement>>>> m_hostFragments;
     // Maps a module to its associated wrapped module; this only happens
     // when a module being resolved has fragments to attach to it.
-    private final Map<Module, WrappedModule> m_allWrappedHosts;
+    private final Map<Module, HostModule> m_allWrappedHosts;
     // Map used when populating candidates to hold intermediate and final results.
     Map<Module, Object> m_populateResultCache;
 
@@ -73,7 +73,7 @@
         Map<Capability, Set<Requirement>> dependentMap,
         Map<Requirement, SortedSet<Capability>> candidateMap,
         Map<Capability, Map<String, Map<Version, List<Requirement>>>> hostFragments,
-        Map<Module, WrappedModule> wrappedHosts, Map<Module, Object> populateResultCache)
+        Map<Module, HostModule> wrappedHosts, Map<Module, Object> populateResultCache)
     {
         m_root = root;
         m_candidateModules = candidateModules;
@@ -97,7 +97,7 @@
         m_candidateMap = new HashMap<Requirement, SortedSet<Capability>>();
         m_hostFragments =
             new HashMap<Capability, Map<String, Map<Version, List<Requirement>>>>();
-        m_allWrappedHosts = new HashMap<Module, WrappedModule>();
+        m_allWrappedHosts = new HashMap<Module, HostModule>();
         m_populateResultCache = new HashMap<Module, Object>();
 
         populate(state, m_root);
@@ -122,7 +122,7 @@
         m_candidateMap = new HashMap<Requirement, SortedSet<Capability>>();
         m_hostFragments =
             new HashMap<Capability, Map<String, Map<Version, List<Requirement>>>>();
-        m_allWrappedHosts = new HashMap<Module, WrappedModule>();
+        m_allWrappedHosts = new HashMap<Module, HostModule>();
         m_populateResultCache = new HashMap<Module, Object>();
 
         add(req, candidates);
@@ -546,7 +546,7 @@
         //      with host's attached fragment capabilities.
 
         // Steps 1 and 2
-        List<WrappedModule> wrappedHosts = new ArrayList<WrappedModule>();
+        List<HostModule> wrappedHosts = new ArrayList<HostModule>();
         List<Module> unselectedFragments = new ArrayList<Module>();
         for (Entry<Capability, Map<String, Map<Version, List<Requirement>>>> hostEntry :
             m_hostFragments.entrySet())
@@ -590,7 +590,7 @@
             }
 
             // Step 2
-            WrappedModule wrappedHost = new WrappedModule(hostCap.getModule(), selectedFragments);
+            HostModule wrappedHost = new HostModule(hostCap.getModule(), selectedFragments);
             wrappedHosts.add(wrappedHost);
             m_allWrappedHosts.put(hostCap.getModule(), wrappedHost);
         }
@@ -602,20 +602,20 @@
         }
 
         // Step 4
-        for (WrappedModule wrappedHost : wrappedHosts)
+        for (HostModule wrappedHost : wrappedHosts)
         {
             // Replaces capabilities from fragments with the capabilities
             // from the merged host.
             for (Capability c : wrappedHost.getCapabilities())
             {
                 Set<Requirement> dependents =
-                    m_dependentMap.get(((WrappedCapability) c).getWrappedCapability());
+                    m_dependentMap.get(((HostedCapability) c).getDeclaredCapability());
                 if (dependents != null)
                 {
                     for (Requirement r : dependents)
                     {
                         Set<Capability> cands = m_candidateMap.get(r);
-                        cands.remove(((WrappedCapability) c).getWrappedCapability());
+                        cands.remove(((HostedCapability) c).getDeclaredCapability());
                         cands.add(c);
                     }
                 }
@@ -627,7 +627,7 @@
             for (Requirement r : wrappedHost.getRequirements())
             {
                 SortedSet<Capability> cands =
-                    m_candidateMap.get(((WrappedRequirement) r).getWrappedRequirement());
+                    m_candidateMap.get(((HostedRequirement) r).getDeclaredRequirement());
                 if (cands != null)
                 {
                     m_candidateMap.put(r, new TreeSet<Capability>(cands));
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java b/framework/src/main/java/org/apache/felix/framework/resolver/HostModule.java
similarity index 88%
rename from framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java
rename to framework/src/main/java/org/apache/felix/framework/resolver/HostModule.java
index 5daacaa..819eeef 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedModule.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/HostModule.java
@@ -32,22 +32,22 @@
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
 
-class WrappedModule implements Module
+class HostModule implements Module
 {
-    private final Module m_module;
+    private final Module m_host;
     private final List<Module> m_fragments;
     private List<Capability> m_cachedCapabilities = null;
     private List<Requirement> m_cachedRequirements = null;
 
-    public WrappedModule(Module module, List<Module> fragments)
+    public HostModule(Module module, List<Module> fragments)
     {
-        m_module = module;
+        m_host = module;
         m_fragments = fragments;
     }
 
-    public Module getWrappedModule()
+    public Module getHost()
     {
-        return m_module;
+        return m_host;
     }
 
     public List<Module> getFragments()
@@ -57,7 +57,7 @@
 
     public String getId()
     {
-        return m_module.getId();
+        return m_host.getId();
     }
 
     public List<Capability> getCapabilities()
@@ -67,13 +67,13 @@
             List<Capability> capList = new ArrayList<Capability>();
 
             // Wrap host capabilities.
-            List<Capability> caps = m_module.getCapabilities();
+            List<Capability> caps = m_host.getCapabilities();
             for (int capIdx = 0;
                 (caps != null) && (capIdx < caps.size());
                 capIdx++)
             {
                 capList.add(
-                    new WrappedCapability(this, caps.get(capIdx)));
+                    new HostedCapability(this, caps.get(capIdx)));
             }
 
             // Wrap fragment capabilities.
@@ -89,7 +89,7 @@
                     if (caps.get(capIdx).getNamespace().equals(Capability.PACKAGE_NAMESPACE))
                     {
                         capList.add(
-                            new WrappedCapability(this, caps.get(capIdx)));
+                            new HostedCapability(this, caps.get(capIdx)));
                     }
                 }
             }
@@ -105,13 +105,13 @@
             List<Requirement> reqList = new ArrayList<Requirement>();
 
             // Wrap host requirements.
-            List<Requirement> reqs = m_module.getRequirements();
+            List<Requirement> reqs = m_host.getRequirements();
             for (int reqIdx = 0;
                 (reqs != null) && (reqIdx < reqs.size());
                 reqIdx++)
             {
                 reqList.add(
-                    new WrappedRequirement(this, reqs.get(reqIdx)));
+                    new HostedRequirement(this, reqs.get(reqIdx)));
             }
 
             // Wrap fragment requirements.
@@ -128,7 +128,7 @@
                         || reqs.get(reqIdx).getNamespace().equals(Capability.MODULE_NAMESPACE))
                     {
                         reqList.add(
-                            new WrappedRequirement(this, reqs.get(reqIdx)));
+                            new HostedRequirement(this, reqs.get(reqIdx)));
                     }
                 }
             }
@@ -139,7 +139,7 @@
 
     public String toString()
     {
-        return m_module.getId();
+        return m_host.getId();
     }
 
     public Map getHeaders()
@@ -154,7 +154,7 @@
 
     public String getSymbolicName()
     {
-        return m_module.getSymbolicName();
+        return m_host.getSymbolicName();
     }
 
     public Version getVersion()
@@ -179,7 +179,7 @@
 
     public Bundle getBundle()
     {
-        return m_module.getBundle();
+        return m_host.getBundle();
     }
 
     public List<Wire> getWires()
@@ -199,7 +199,7 @@
 
     public boolean isRemovalPending()
     {
-        return m_module.isRemovalPending();
+        return m_host.isRemovalPending();
     }
 
     public Content getContent()
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java b/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
similarity index 63%
rename from framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java
rename to framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
index 29f5d00..04c68b7 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
@@ -23,25 +23,57 @@
 import org.apache.felix.framework.capabilityset.Capability;
 import org.apache.felix.framework.capabilityset.Directive;
 
-class WrappedCapability implements Capability
+public class HostedCapability implements Capability
 {
-    private final Module m_module;
+    private final Module m_host;
     private final Capability m_cap;
 
-    public WrappedCapability(Module module, Capability cap)
+    public HostedCapability(Module module, Capability cap)
     {
-        m_module = module;
+        m_host = module;
         m_cap = cap;
     }
 
-    public Capability getWrappedCapability()
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
+        final HostedCapability other = (HostedCapability) obj;
+        if (m_host != other.m_host && (m_host == null || !m_host.equals(other.m_host)))
+        {
+            return false;
+        }
+        if (m_cap != other.m_cap && (m_cap == null || !m_cap.equals(other.m_cap)))
+        {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int hash = 7;
+        hash = 37 * hash + (m_host != null ? m_host.hashCode() : 0);
+        hash = 37 * hash + (m_cap != null ? m_cap.hashCode() : 0);
+        return hash;
+    }
+
+    public Capability getDeclaredCapability()
     {
         return m_cap;
     }
 
     public Module getModule()
     {
-        return m_module;
+        return m_host;
     }
 
     public String getNamespace()
@@ -74,17 +106,18 @@
         return m_cap.getUses();
     }
 
+    @Override
     public String toString()
     {
-        if (m_module == null)
+        if (m_host == null)
         {
             return getAttributes().toString();
         }
         if (getNamespace().equals(Capability.PACKAGE_NAMESPACE))
         {
-            return "[" + m_module + "] "
+            return "[" + m_host + "] "
                 + getNamespace() + "; " + getAttribute(Capability.PACKAGE_ATTR);
         }
-        return "[" + m_module + "] " + getNamespace() + "; " + getAttributes();
+        return "[" + m_host + "] " + getNamespace() + "; " + getAttributes();
     }
 }
\ No newline at end of file
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRequirement.java b/framework/src/main/java/org/apache/felix/framework/resolver/HostedRequirement.java
similarity index 60%
rename from framework/src/main/java/org/apache/felix/framework/resolver/WrappedRequirement.java
rename to framework/src/main/java/org/apache/felix/framework/resolver/HostedRequirement.java
index a188ce1..10f6f53 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRequirement.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/HostedRequirement.java
@@ -23,25 +23,57 @@
 import org.apache.felix.framework.capabilityset.Requirement;
 import org.apache.felix.framework.capabilityset.SimpleFilter;
 
-class WrappedRequirement implements Requirement
+public class HostedRequirement implements Requirement
 {
-    private final Module m_module;
+    private final Module m_host;
     private final Requirement m_req;
 
-    public WrappedRequirement(Module module, Requirement req)
+    public HostedRequirement(Module module, Requirement req)
     {
-        m_module = module;
+        m_host = module;
         m_req = req;
     }
 
-    public Requirement getWrappedRequirement()
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
+        final HostedRequirement other = (HostedRequirement) obj;
+        if (m_host != other.m_host && (m_host == null || !m_host.equals(other.m_host)))
+        {
+            return false;
+        }
+        if (m_req != other.m_req && (m_req == null || !m_req.equals(other.m_req)))
+        {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int hash = 7;
+        hash = 37 * hash + (m_host != null ? m_host.hashCode() : 0);
+        hash = 37 * hash + (m_req != null ? m_req.hashCode() : 0);
+        return hash;
+    }
+
+    public Requirement getDeclaredRequirement()
     {
         return m_req;
     }
 
     public Module getModule()
     {
-        return m_module;
+        return m_host;
     }
 
     public String getNamespace()
@@ -71,6 +103,6 @@
 
     public String toString()
     {
-        return "[" + m_module + "] " + getNamespace() + "; " + getFilter().toString();
+        return "[" + m_host + "] " + getNamespace() + "; " + getFilter().toString();
     }
 }
\ No newline at end of file
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java b/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
index e061ad9..e750bad 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
@@ -146,11 +146,11 @@
                     if (rethrow != null)
                     {
                         Module faultyModule = getActualModule(rethrow.getModule());
-                        if (rethrow.getRequirement() instanceof WrappedRequirement)
+                        if (rethrow.getRequirement() instanceof HostedRequirement)
                         {
                             faultyModule =
-                                ((WrappedRequirement) rethrow.getRequirement())
-                                    .getWrappedRequirement().getModule();
+                                ((HostedRequirement) rethrow.getRequirement())
+                                    .getDeclaredRequirement().getModule();
                         }
                         if (fragments.remove(faultyModule))
                         {
@@ -281,11 +281,11 @@
                     if (rethrow != null)
                     {
                         Module faultyModule = getActualModule(rethrow.getModule());
-                        if (rethrow.getRequirement() instanceof WrappedRequirement)
+                        if (rethrow.getRequirement() instanceof HostedRequirement)
                         {
                             faultyModule =
-                                ((WrappedRequirement) rethrow.getRequirement())
-                                    .getWrappedRequirement().getModule();
+                                ((HostedRequirement) rethrow.getRequirement())
+                                    .getDeclaredRequirement().getModule();
                         }
                         if (fragments.remove(faultyModule))
                         {
@@ -485,7 +485,7 @@
                 Requirement r = wire.getRequirement();
                 if (!r.getModule().equals(wire.getImporter()))
                 {
-                    r = new WrappedRequirement(wire.getImporter(), r);
+                    r = new HostedRequirement(wire.getImporter(), r);
                 }
                 // Wrap the capability as a hosted capability
                 // if it comes from a fragment, since we will need
@@ -493,7 +493,7 @@
                 Capability c = wire.getCapability();
                 if (!c.getModule().equals(wire.getExporter()))
                 {
-                    c = new WrappedCapability(wire.getExporter(), c);
+                    c = new HostedCapability(wire.getExporter(), c);
                 }
                 reqs.add(r);
                 caps.add(c);
@@ -1291,27 +1291,27 @@
 
     private static Module getActualModule(Module m)
     {
-        if (m instanceof WrappedModule)
+        if (m instanceof HostModule)
         {
-            return ((WrappedModule) m).getWrappedModule();
+            return ((HostModule) m).getHost();
         }
         return m;
     }
 
     private static Capability getActualCapability(Capability c)
     {
-        if (c instanceof WrappedCapability)
+        if (c instanceof HostedCapability)
         {
-            return ((WrappedCapability) c).getWrappedCapability();
+            return ((HostedCapability) c).getDeclaredCapability();
         }
         return c;
     }
 
     private static Requirement getActualRequirement(Requirement r)
     {
-        if (r instanceof WrappedRequirement)
+        if (r instanceof HostedRequirement)
         {
-            return ((WrappedRequirement) r).getWrappedRequirement();
+            return ((HostedRequirement) r).getDeclaredRequirement();
         }
         return r;
     }
@@ -1370,9 +1370,9 @@
             wireMap.put(unwrappedModule, packageWires);
 
             // Add host wire for any fragments.
-            if (module instanceof WrappedModule)
+            if (module instanceof HostModule)
             {
-                List<Module> fragments = ((WrappedModule) module).getFragments();
+                List<Module> fragments = ((HostModule) module).getFragments();
                 for (Module fragment : fragments)
                 {
                     List<Wire> hostWires = wireMap.get(fragment);
