diff --git a/rpmUtils/arch.py b/rpmUtils/arch.py
index 02df57c..dc84178 100644
--- a/rpmUtils/arch.py
+++ b/rpmUtils/arch.py
@@ -9,7 +9,6 @@ multilibArches = { "x86_64":  ( "athlon", "x86_64", "athlon" ),
                    "sparc64": ( "sparc", "sparcv9", "sparc64" ),
                    "ppc64":   ( "ppc", "ppc", "ppc64" ),
                    "s390x":   ( "s390", "s390x", "s390" ),
-                   "ia64":    ( "i686", "ia64", "i686" )
                    }
 
 arches = {
@@ -26,9 +25,6 @@ arches = {
     "amd64": "x86_64",
     "ia32e": "x86_64",
     
-    # itanium
-    "ia64": "i686",
-    
     # ppc
     "ppc64pseries": "ppc64",
     "ppc64iseries": "ppc64",    
@@ -60,6 +56,25 @@ arches = {
     "armv5tel": "noarch",
     }
 
+def legitMultiArchesInSameLib(arch=None):
+    # this is completely crackrock - if anyone has a better way I
+    # am all ears
+    
+    arch = getBestArch(arch)
+    if isMultiLibArch(arch):
+        arch = getBaseArch(myarch=arch)
+         
+    results = [arch]
+   
+    if arch == 'x86_64' or arch.startswith('sparcv9'):
+        for (k, v) in arches.items():
+            if v == arch:
+                results.append(k)
+    return results        
+
+
+
+
 # this computes the difference between myarch and targetarch
 def archDifference(myarch, targetarch):
     if myarch == targetarch:
diff --git a/yum/__init__.py b/yum/__init__.py
index c6f8750..93dc2c0 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1288,9 +1288,8 @@ class YumBase(depsolve.Depsolve):
             else:
                 avail = self.pkgSack.returnNewestByNameArch(patterns=patterns)
             
-            self.rpmdb._make_header_dict()
             for pkg in avail:
-                if not self.rpmdb._header_dict.has_key(pkg.pkgtup):
+                if not self.rpmdb._tup2pkg.has_key(pkg.pkgtup):
                     available.append(pkg)
 
 
@@ -1979,6 +1978,7 @@ class YumBase(depsolve.Depsolve):
            """
         
         pkgs = []
+        was_pattern = False
         if po:
             if isinstance(po, YumAvailablePackage) or isinstance(po, YumLocalPackage):
                 pkgs.append(po)
@@ -1990,6 +1990,7 @@ class YumBase(depsolve.Depsolve):
                 raise Errors.InstallError, _('Nothing specified to install')
 
             if kwargs.has_key('pattern'):
+                was_pattern = True
                 exactmatch, matched, unmatched = \
                     parsePackages(self.pkgSack.returnPackages(),[kwargs['pattern']] , casematch=1)
                 pkgs.extend(exactmatch)
@@ -2018,6 +2019,32 @@ class YumBase(depsolve.Depsolve):
                      ver=nevra_dict['version'], rel=nevra_dict['release'])
                 
             if pkgs:
+                # FIXME - if was_pattern or nevra-dict['arch'] is none, take the list
+                # of arches based on our multilib_compat config and 
+                # toss out any pkgs of any arch NOT in that arch list
+
+                
+                # only do these things if we're multilib
+                if rpmUtils.arch.isMultiLibArch():
+                    if was_pattern or not nevra_dict['arch']: # and only if they
+                                                              # they didn't specify an arch
+                       if self.conf.multilib_policy == 'best':
+                           print 'foo'
+                           pkgs_by_name = {}
+                           use = []
+                           not_added = []
+                           for pkg in pkgs:
+                               if pkg.arch in rpmUtils.arch.legitMultiArchesInSameLib():
+                                   pkgs_by_name[pkg.name] = 1    
+                                   use.append(pkg)  
+                               else:
+                                   not_added.append(pkg)
+                           for pkg in not_added:
+                               if not pkg.name in pkgs_by_name:
+                                   use.append(pkg)
+                           
+                           pkgs = use
+                           
                 pkgSack = ListPackageSack(pkgs)
                 pkgs = pkgSack.returnNewestByName()
                 del(pkgSack)
@@ -2043,6 +2070,7 @@ class YumBase(depsolve.Depsolve):
         #  - install instead of erase
         #  - better error handling/reporting
 
+
         tx_return = []
         for po in pkgs:
             if self.tsInfo.exists(pkgtup=po.pkgtup):
diff --git a/yum/config.py b/yum/config.py
index 38b66ba..416187a 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -637,6 +637,10 @@ class YumConf(StartupConf):
     mdpolicy = SelectionOption('group:primary',
                                ('instant', 'group:all', 'group:main',
                                 'group:small', 'group:primary'))
+    multilib_policy = SelectionOption('all',('best', 'all'))
+                 # all == install any/all arches you can
+                 # best == use the 'best  arch' for the system
+                 
 
     
     _reposlist = []
