diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index c18ee0c4a0f20af61a2d8f1d1eaf39d9a8a5c503..e29308d3d160a6c61618aa0cfee3f83a8ee40ce3 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -734,15 +734,15 @@ void hide_context_entries(LLMenuGL& menu,
 		}
 
 		bool found = false;
-		menuentry_vec_t::const_iterator itor2;
-		for (itor2 = entries_to_show.begin(); itor2 != entries_to_show.end(); ++itor2)
-		{
-			if (*itor2 == name)
-			{
-				found = true;
-				break;
-			}
-		}
+
+        std::string myinput;
+        std::vector<std::string> mylist{ "a", "b", "c" };
+
+        menuentry_vec_t::const_iterator itor2 = std::find(entries_to_show.begin(), entries_to_show.end(), name);
+        if (itor2 != entries_to_show.end())
+        {
+            found = true;
+        }
 
 		// Don't allow multiple separators in a row (e.g. such as if there are no items
 		// between two separators).
@@ -760,7 +760,21 @@ void hide_context_entries(LLMenuGL& menu,
 				menu_item->setVisible(FALSE);
 			}
 
-			menu_item->setEnabled(FALSE);
+            if (menu_item->getEnabled())
+            {
+                // These should stay enabled unless specifically disabled
+                const menuentry_vec_t exceptions = {
+                    "Detach From Yourself",
+                    "Wearable And Object Wear",
+                    "Wearable Add",
+                };
+
+                menuentry_vec_t::const_iterator itor2 = std::find(exceptions.begin(), exceptions.end(), name);
+                if (itor2 == exceptions.end())
+                {
+                    menu_item->setEnabled(FALSE);
+                }
+            }
 		}
 		else
 		{
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 27edc8148efc638062c5d43063048263b98f0c6c..fb73d391ec141d4986ea045e926b0ddfb8dc8cd8 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -2583,8 +2583,62 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
 	}
 
 	std::set<LLUUID> selected_uuid_set = LLAvatarActions::getInventorySelectedUUIDs();
+
+    // copy list of applicable items into a vector for bulk handling
     uuid_vec_t ids;
-    std::copy(selected_uuid_set.begin(), selected_uuid_set.end(), std::back_inserter(ids));
+    if (action == "wear" || action == "wear_add")
+    {
+        const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+        const LLUUID mp_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
+        std::copy_if(selected_uuid_set.begin(),
+            selected_uuid_set.end(),
+            std::back_inserter(ids),
+            [trash_id, mp_id](LLUUID id)
+        {
+            if (get_is_item_worn(id)
+                || LLAppearanceMgr::instance().getIsInCOF(id)
+                || gInventory.isObjectDescendentOf(id, trash_id))
+            {
+                return false;
+            }
+            if (mp_id.notNull() && gInventory.isObjectDescendentOf(id, mp_id))
+            {
+                return false;
+            }
+            LLInventoryObject* obj = (LLInventoryObject*)gInventory.getObject(id);
+            if (!obj)
+            {
+                return false;
+            }
+            if (obj->getIsLinkType() && gInventory.isObjectDescendentOf(obj->getLinkedUUID(), trash_id))
+            {
+                return false;
+            }
+            if (obj->getIsLinkType() && LLAssetType::lookupIsLinkType(obj->getType()))
+            {
+                // missing
+                return false;
+            }
+            return true;
+        }
+        );
+    }
+    else if (isRemoveAction(action))
+    {
+        std::copy_if(selected_uuid_set.begin(),
+            selected_uuid_set.end(),
+            std::back_inserter(ids),
+            [](LLUUID id)
+        {
+            return get_is_item_worn(id);
+        }
+        );
+    }
+    else
+    {
+        std::copy(selected_uuid_set.begin(), selected_uuid_set.end(), std::back_inserter(ids));
+    }
+
     // Check for actions that get handled in bulk
     if (action == "wear")
     {