diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp
index 55e87c1550576699cc941f946362f74059a1ab82..f0a09f22efe172676c981feb957e20187cdaff29 100644
--- a/indra/llcharacter/llbvhloader.cpp
+++ b/indra/llcharacter/llbvhloader.cpp
@@ -515,7 +515,7 @@ ELoadStatus LLBVHLoader::loadAliases(const char * filename)
     {
         if ( LLSDSerialize::fromXML(aliases_sd, input_stream) )
         {
-            for(const auto& alias_pair : aliases_sd.map())
+            for(const auto& alias_pair : aliases_sd.asMap())
             {
                 LLSD::String alias_name = alias_pair.first;
                 LLSD::String joint_name = alias_pair.second;
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index fb2e6d6ef120a974d592257507058c870daa7828..636083787d86c1d3e2bc368ff52ce554befa9d0a 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -922,7 +922,7 @@ namespace LLError
 namespace {
 	void setLevels(LevelMap& map, const LLSD& list, LLError::ELevel level)
 	{
-		for (const auto& i : list.array())
+		for (const auto& i : list.asArray())
 		{
 			map[i.asString()] = level;
 		}
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index 6942655025c56e6aef7c3456e284ffeecaa9d1ba..50d554ba18742585a78b97c9e00a45b325489a4c 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -325,7 +325,7 @@ class LLProcessorInfoImpl
 		out << "// CPU Extensions" << std::endl;
 		out << "//////////////////////////" << std::endl;
 		
-		for(const auto& llsd_pair : mProcessorInfo["extension"].map())
+		for(const auto& llsd_pair : mProcessorInfo["extension"].asMap())
 		{
 			out << "  " << llsd_pair.first << std::endl;
 		}
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index 378c070d74adf0bec419b274b8e5c25ab9df5917..d9d54b89ae154836035e58b650c067627d9dc3c1 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -100,6 +100,9 @@ class LLSD::Impl
 	
 	U32 mUseCount;
 
+	const LLSD::map_t& map() const { static const LLSD::map_t empty; return empty; }
+	const std::vector<LLSD>& array() const { static const std::vector<LLSD> empty; return empty; }
+
 public:
 	static void reset(Impl*& var, Impl* impl);
 		///< safely set var to refer to the new impl (possibly shared)
@@ -141,6 +144,8 @@ class LLSD::Impl
 	virtual Date	asDate() const				{ return LLDate(); }
 	virtual URI		asURI() const				{ return LLURI(); }
 	virtual const Binary&	asBinary() const	{ static const std::vector<U8> empty; return empty; }
+	virtual const map_t& asMap() const			{ return map(); };
+	virtual const array_t& asArray() const		{ return array(); };
 
 	virtual const String& asStringRef() const { static const std::string empty; return empty; } 
 	
@@ -155,15 +160,10 @@ class LLSD::Impl
 	virtual void erase(size_t)					{ }
 	virtual const LLSD& ref(size_t) const		{ return undef(); }
 
-	virtual const LLSD::map_t& map() const { static const LLSD::map_t empty; return empty; }
-	virtual LLSD::map_t& map() { static LLSD::map_t empty; return empty; }
-	LLSD::map_const_iterator beginMap() const { return endMap(); }
-	LLSD::map_const_iterator endMap() const { return map().end(); }
-	virtual const std::vector<LLSD>& array() const { static const std::vector<LLSD> empty; return empty; }
-	virtual std::vector<LLSD>& array() { static std::vector<LLSD> empty; return empty; }
-	LLSD::array_const_iterator beginArray() const { return endArray(); }
-	LLSD::array_const_iterator endArray() const { return array().end(); }
-
+	virtual LLSD::map_const_iterator beginMap() const { return endMap(); }
+	virtual LLSD::map_const_iterator endMap() const { return map().end(); }
+	virtual LLSD::array_const_iterator beginArray() const { return endArray(); }
+	virtual LLSD::array_const_iterator endArray() const { return array().end(); }
 
 	virtual void dumpStats() const;
 	virtual void calcStats(S32 type_counts[], S32 share_counts[]) const;
@@ -393,6 +393,9 @@ namespace
 
         LLSD::Boolean asBoolean() const override { return !mData.empty(); }
 
+		LLSD::map_t& asMap() { return mData; };
+		const LLSD::map_t& asMap() const override { return mData; };
+
         bool has(const std::string_view) const override;
 
 		using LLSD::Impl::get; // Unhiding get(size_t)
@@ -407,8 +410,10 @@ namespace
 
 		size_t size() const override { return mData.size(); }
 
-		DataMap& map() final override { return mData; }
-		const DataMap& map() const final override { return mData; }
+		LLSD::map_iterator beginMap() { return mData.begin(); }
+		LLSD::map_iterator endMap() { return mData.end(); }
+		LLSD::map_const_iterator beginMap() const override { return mData.begin(); }
+		LLSD::map_const_iterator endMap() const override { return mData.end(); }
 
         void dumpStats() const override;
         void calcStats(S32 type_counts[], S32 share_counts[]) const override;
@@ -537,6 +542,9 @@ namespace
 
         LLSD::Boolean asBoolean() const override { return !mData.empty(); }
 
+		DataVector& asArray() { return mData; };
+		const DataVector& asArray() const override { return mData; };
+
 		using LLSD::Impl::get; // Unhiding get(LLSD::String)
 		using LLSD::Impl::erase; // Unhiding erase(LLSD::String)
 		using LLSD::Impl::ref; // Unhiding ref(LLSD::String)
@@ -549,8 +557,12 @@ namespace
 		              LLSD& ref(size_t);
 		virtual const LLSD& ref(size_t) const override; 
 
-		DataVector& array() final override { return mData; }
-		const DataVector& array() const final override { return mData; }
+		LLSD::array_iterator beginArray() { return mData.begin(); }
+		LLSD::array_iterator endArray() { return mData.end(); }
+		LLSD::reverse_array_iterator rbeginArray() { return mData.rbegin(); }
+		LLSD::reverse_array_iterator rendArray() { return mData.rend(); }
+		virtual LLSD::array_const_iterator beginArray() const { return mData.begin(); }
+		virtual LLSD::array_const_iterator endArray() const { return mData.end(); }
 
         void calcStats(S32 type_counts[], S32 share_counts[]) const override;
 	};
@@ -906,6 +918,11 @@ LLSD::Date		LLSD::asDate() const	{ return safe(impl).asDate(); }
 LLSD::URI		LLSD::asURI() const		{ return safe(impl).asURI(); }
 const LLSD::Binary&	LLSD::asBinary() const	{ return safe(impl).asBinary(); }
 
+LLSD::map_t& LLSD::asMap() { return makeMap(impl).asMap(); };
+const LLSD::map_t& LLSD::asMap() const { return safe(impl).asMap(); };
+LLSD::array_t& LLSD::asArray() { return makeArray(impl).asArray(); };
+const LLSD::array_t& LLSD::asArray() const { return safe(impl).asArray(); };
+
 const LLSD::String& LLSD::asStringRef() const { return safe(impl).asStringRef(); }
 
 // const char * helpers
@@ -1017,24 +1034,18 @@ const char *LLSD::dump(const LLSD &llsd)
 	return llsd_dump(llsd, false);
 }
 
-LLSD::map_t& LLSD::map() { return makeMap(impl).map(); }
-const LLSD::map_t& LLSD::map() const { return safe(impl).map(); }
-
-LLSD::map_iterator			LLSD::beginMap()		{ return map().begin(); }
-LLSD::map_iterator			LLSD::endMap()			{ return map().end(); }
-LLSD::map_const_iterator	LLSD::beginMap() const	{ return map().cbegin(); }
-LLSD::map_const_iterator	LLSD::endMap() const	{ return map().cend(); }
-
-std::vector<LLSD>& LLSD::array() { return makeArray(impl).array(); }
-const std::vector<LLSD>& LLSD::array() const { return safe(impl).array(); }
+LLSD::map_iterator			LLSD::beginMap()		{ return makeMap(impl).beginMap(); }
+LLSD::map_iterator			LLSD::endMap()			{ return makeMap(impl).endMap(); }
+LLSD::map_const_iterator	LLSD::beginMap() const	{ return safe(impl).beginMap(); }
+LLSD::map_const_iterator	LLSD::endMap() const	{ return safe(impl).endMap(); }
 
-LLSD::array_iterator		LLSD::beginArray()		{ return array().begin(); }
-LLSD::array_iterator		LLSD::endArray()		{ return array().end(); }
-LLSD::array_const_iterator	LLSD::beginArray() const{ return array().cbegin(); }
-LLSD::array_const_iterator	LLSD::endArray() const	{ return array().cend(); }
+LLSD::array_iterator		LLSD::beginArray()		{ return makeArray(impl).beginArray(); }
+LLSD::array_iterator		LLSD::endArray()		{ return makeArray(impl).endArray(); }
+LLSD::array_const_iterator	LLSD::beginArray() const{ return safe(impl).beginArray(); }
+LLSD::array_const_iterator	LLSD::endArray() const	{ return safe(impl).endArray(); }
 
-LLSD::reverse_array_iterator	LLSD::rbeginArray()		{ return array().rbegin(); }
-LLSD::reverse_array_iterator	LLSD::rendArray()		{ return array().rend(); }
+LLSD::reverse_array_iterator	LLSD::rbeginArray()		{ return makeArray(impl).rbeginArray(); }
+LLSD::reverse_array_iterator	LLSD::rendArray()		{ return makeArray(impl).rendArray(); }
 
 namespace llsd
 {
diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h
index dbe43f37df7cc56c58123a3a8c77a38f5121b407..b1017873e9a3cc50b754fb5c4f63b09d93717198 100644
--- a/indra/llcommon/llsd.h
+++ b/indra/llcommon/llsd.h
@@ -184,6 +184,8 @@ class LL_COMMON_API LLSD final
 		typedef LLDate			Date;
 		typedef LLURI			URI;
 		typedef std::vector<U8>	Binary;
+		typedef std::map<String, LLSD, std::less<>>					map_t;
+		typedef std::vector<LLSD> array_t;
 	//@}
 	
 	/** @name Scalar Constructors */
@@ -286,6 +288,14 @@ class LL_COMMON_API LLSD final
 		URI		asURI() const;
 		const Binary&	asBinary() const;
 
+		// Direct access to underlying map. Will return empty map on any non-map type.
+		map_t& asMap();
+		const map_t& asMap() const; 
+
+		// Direct access to underlying std::vector. Will return empty vector on any non-map type.
+		array_t& asArray();
+		const array_t& asArray() const;
+
 		// asStringRef on any non-string type will return a ref to an empty string.
 		const String&	asStringRef() const;
 
@@ -359,25 +369,18 @@ class LL_COMMON_API LLSD final
 	//@{
 		size_t size() const;
 
-		typedef std::map<String, LLSD, std::less<>>					map_t;
 		typedef map_t::iterator		map_iterator;
 		typedef map_t::const_iterator	map_const_iterator;
 		
-		map_t& map();
-		const map_t& map() const;
-
 		map_iterator		beginMap();
 		map_iterator		endMap();
 		map_const_iterator	beginMap() const;
 		map_const_iterator	endMap() const;
 		
-		typedef std::vector<LLSD>::iterator			array_iterator;
-		typedef std::vector<LLSD>::const_iterator	array_const_iterator;
-		typedef std::vector<LLSD>::reverse_iterator reverse_array_iterator;
+		typedef array_t::iterator			array_iterator;
+		typedef array_t::const_iterator	array_const_iterator;
+		typedef array_t::reverse_iterator reverse_array_iterator;
 		
-		std::vector<LLSD>& array();
-		const std::vector<LLSD>& array() const;
-
 		array_iterator			beginArray();
 		array_iterator			endArray();
 		array_const_iterator	beginArray() const;
diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp
index c81a84935aecb1ebb93d72bc1ca04c6d03d9d092..7bcea2b71c1cea68eb022e906580e6756e076aec 100644
--- a/indra/llcommon/llsdparam.cpp
+++ b/indra/llcommon/llsdparam.cpp
@@ -254,7 +254,7 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI
 {
 	if (sd.isMap())
 	{
-		for (const auto& llsd_pair : sd.map())
+		for (const auto& llsd_pair : sd.asMap())
 		{
 			stack.push_back(make_pair(llsd_pair.first, true));
 			readSDValues(cb, llsd_pair.second, stack);
@@ -263,7 +263,7 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI
 	}
 	else if (sd.isArray())
 	{
-		for (const auto& llsd_val : sd.array())
+		for (const auto& llsd_val : sd.asArray())
 		{
 			stack.push_back(make_pair(std::string(), true));
 			readSDValues(cb, llsd_val, stack);
diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp
index 330936444fb18d19d38aa8f03f4e2c57221b4380..dd2ecda802bda1f032c0d1796f700b7a6bb8563d 100644
--- a/indra/llcommon/llsdutil.cpp
+++ b/indra/llcommon/llsdutil.cpp
@@ -286,7 +286,7 @@ BOOL compare_llsd_with_template(
 		LLSD value;
 
 		resultant_llsd = LLSD::emptyMap();
-		for (const auto& template_pair : template_llsd.map())
+		for (const auto& template_pair : template_llsd.asMap())
 		{
 			if ( llsd_to_test.has(template_pair.first) )
 			{
@@ -680,7 +680,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
         out << colon(pfx);
         const char* init = "Map missing keys: ";
         const char* sep = init;
-        for (const auto& prototype_pair : prototype.map())
+        for (const auto& prototype_pair : prototype.asMap())
         {
             if (! data.has(prototype_pair.first))
             {
@@ -695,7 +695,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
         }
         // Good, the data block contains all the keys required by the
         // prototype. Now match the prototype entries.
-        for (const auto& prototype_pair : prototype.map())
+        for (const auto& prototype_pair : prototype.asMap())
         {
             std::string match(llsd_matches(prototype_pair.second, data[prototype_pair.first],
                                            STRINGIZE("['" << prototype_pair.first << "']")));
@@ -957,7 +957,7 @@ LLSD llsd_clone(LLSD value, LLSD filter)
     {
     case LLSD::TypeMap:
         clone = LLSD::emptyMap();
-        for (const auto& value_pair : value.map())
+        for (const auto& value_pair : value.asMap())
         {
             if (has_filter)
             {
@@ -981,7 +981,7 @@ LLSD llsd_clone(LLSD value, LLSD filter)
         break;
     case LLSD::TypeArray:
         clone = LLSD::emptyArray();
-        for (const auto& llsd_val : value.array())
+        for (const auto& llsd_val : value.asArray())
         {
             clone.append(llsd_clone(llsd_val, filter));
         }
@@ -1008,7 +1008,7 @@ LLSD llsd_shallow(LLSD value, LLSD filter)
     if (value.isMap())
     {
         shallow = LLSD::emptyMap();
-        for (const auto& value_pair : value.map())
+        for (const auto& value_pair : value.asMap())
         {
             if (has_filter)
             {
@@ -1033,7 +1033,7 @@ LLSD llsd_shallow(LLSD value, LLSD filter)
     else if (value.isArray())
     {
         shallow = LLSD::emptyArray();
-        for (const auto& llsd_val : value.array())
+        for (const auto& llsd_val : value.asArray())
         {
             shallow.append(llsd_val);
         }
diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index 51a45d28753e4bbb0b67106b3d96a2c28403882d..f8cc1deff3278fe7614ce4d73974176931afc4f1 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -446,7 +446,7 @@ LLURI LLURI::buildHTTP(const std::string& prefix,
 	if (path.isArray())
 	{
 		// break out and escape each path component
-		for (const auto& llsd_val : path.array())
+		for (const auto& llsd_val : path.asArray())
 		{
 			const std::string& str = llsd_val.asStringRef();
 			LL_DEBUGS() << "PATH: inserting " << str << LL_ENDL;
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 53af26ced7682addab0bb15e1d2b529f7f7fc8e2..f17bf07afaea75a35d22848b312c29e5af533af7 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -900,7 +900,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new)
     // TODO - figure out if this should be moved into the noclobber fields above
     mThumbnailUUID.setNull();
 
-	const auto& sdMap = sd.map();
+	const auto& sdMap = sd.asMap();
 	auto itEnd = sdMap.end();
 
 	auto it = sdMap.find(INV_ITEM_ID_LABEL);
@@ -1171,7 +1171,7 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd)
 {
 	mThumbnailUUID.setNull();
 
-	const auto& sdMap = sd.map();
+	const auto& sdMap = sd.asMap();
 	auto itEnd = sdMap.end();
 
 	auto it = sdMap.find(INV_FOLDER_ID_LABEL_WS);
@@ -1366,7 +1366,7 @@ LLSD LLInventoryCategory::exportLLSD() const
 
 bool LLInventoryCategory::importLLSD(const LLSD& cat_data)
 {
-	const auto& sdMap = cat_data.map();
+	const auto& sdMap = cat_data.asMap();
 	auto itEnd = sdMap.end();
 
 	auto it = sdMap.find(INV_FOLDER_ID_LABEL);
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index 93e33c2e1e0bc3ef2351eaa50fdb89f5b48eba95..6618d5cfbe058be8f8d304af20307385b9f885db 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -93,7 +93,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
 {
     LLSD newSettings;
 
-    for (const auto& llsd_pair : settings.map())
+    for (const auto& llsd_pair : settings.asMap())
     {
         const std::string& key_name = llsd_pair.first;
         const LLSD& value = llsd_pair.second;
@@ -106,7 +106,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
             break;
         case LLSD::TypeArray:
             newSettings[key_name] = LLSD::emptyArray();
-            for (const auto& llsd_val : value.array())
+            for (const auto& llsd_val : value.asArray())
             {
                 newSettings[key_name].append(llsd_val);
             }
@@ -127,7 +127,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
 
     if (!other.isUndefined())
     {
-        for (const auto& llsd_pair : other.map())
+        for (const auto& llsd_pair : other.asMap())
         {
             const std::string& key_name = llsd_pair.first;
             const LLSD& value = llsd_pair.second;
@@ -140,7 +140,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
                 break;
             case LLSD::TypeArray:
                 newSettings[key_name] = LLSD::emptyArray();
-                for (const auto& llsd_val : value.array())
+                for (const auto& llsd_val : value.asArray())
                 {
                     newSettings[key_name].append(llsd_val);
                 }
@@ -172,8 +172,8 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
 
     //llassert(mix >= 0.0f && mix <= 1.0f);
 
-    const auto& other_map = other.map();
-    const auto& settings_map = settings.map();
+    const auto& other_map = other.asMap();
+    const auto& settings_map = settings.asMap();
     const auto skipEnd = skip.end();
     const auto settingsEnd = settings_map.end();
 
@@ -231,7 +231,7 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
     }
 
     // Now add anything that is in other but not in the settings
-    for (const auto& llsd_pair : other.map())
+    for (const auto& llsd_pair : other.asMap())
     {
         const std::string& key_name = llsd_pair.first;
 
@@ -257,7 +257,7 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
     }
 
     // Note: writes variables from skip list, bug?
-    for (const auto& llsd_pair : other.map())
+    for (const auto& llsd_pair : other.asMap())
     {
         // TODO: Should I blend this in instead?
         if (skip.find(llsd_pair.first) == skipEnd)
@@ -512,7 +512,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, const validation_list_t &
     }
 
     // strip extra entries
-    for (const auto& setting_pair : settings.map())
+    for (const auto& setting_pair : settings.asMap())
     {
         if (validated.find(setting_pair.first) == validated.end())
         {
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index c549507e61ddeb8459f1001aeb94c2902d1fbc5f..a463fa275a9ec00a83a220c2476be2e3a144d979 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -204,7 +204,7 @@ bool LLSettingsDay::initialize(bool validate_frames)
 
     std::map<std::string, LLSettingsBase::ptr_t> used;
 
-    for (const auto& llsd_pair : frames.map())
+    for (const auto& llsd_pair : frames.asMap())
     {
         const std::string& name = llsd_pair.first;
         const LLSD& data = llsd_pair.second;
@@ -238,7 +238,7 @@ bool LLSettingsDay::initialize(bool validate_frames)
     {
         mDayTracks[i].clear();
         LLSD curtrack = tracks[i];
-        for (const auto& llsd_val : curtrack.array())
+        for (const auto& llsd_val : curtrack.asArray())
         {
             LLSettingsBase::TrackPosition keyframe = LLSettingsBase::TrackPosition(llsd_val[SETTING_KEYKFRAME].asReal());
             keyframe = llclamp(keyframe, 0.0f, 1.0f);
@@ -467,7 +467,7 @@ namespace
 
         S32 framecount(0);
 
-        for (auto& llsd_val : value.array())
+        for (auto& llsd_val : value.asArray())
         {
             S32 index = 0;
             while (index < llsd_val.size())
@@ -533,7 +533,7 @@ namespace
         bool hasSky(false);
         bool hasWater(false);
 
-        for (const auto& llsd_pair : value.map())
+        for (const auto& llsd_pair : value.asMap())
         {
             LLSD frame = llsd_pair.second;
 
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 6ad2e9c260b733090e02fc675cb4e203e67df750..7a2e325d808c6c9f0fa9a76c60f2e49f3d9cdf2f 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -276,7 +276,7 @@ bool validateRayleighLayers(LLSD &value, U32 flags)
     if (value.isArray())
     {
         bool allGood = true;
-        for (LLSD& layerConfig : value.array())
+        for (LLSD& layerConfig : value.asArray())
         {
             if (layerConfig.type() == LLSD::TypeMap)
             {
@@ -317,7 +317,7 @@ bool validateAbsorptionLayers(LLSD &value, U32 flags)
     if (value.isArray())
     {
         bool allGood = true;   
-        for (LLSD& layerConfig : value.array())
+        for (LLSD& layerConfig : value.asArray())
         {
             if (layerConfig.type() == LLSD::TypeMap)
             {
@@ -358,7 +358,7 @@ bool validateMieLayers(LLSD &value, U32 flags)
     if (value.isArray())
     {
         bool allGood = true;
-        for (LLSD& layerConfig : value.array())
+        for (LLSD& layerConfig : value.asArray())
         {
             if (layerConfig.type() == LLSD::TypeMap)
             {
@@ -1028,11 +1028,11 @@ LLColor3 LLSettingsSky::getLightDiffuse() const
 LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value) const
 {
     LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
-    const auto& settings_map = mSettings.map();
+    const auto& settings_map = mSettings.asMap();
     auto legacy_it = settings_map.find(SETTING_LEGACY_HAZE);
     if (legacy_it != settings_map.end())
     {
-        const auto& legacy_map = legacy_it->second.map();
+        const auto& legacy_map = legacy_it->second.asMap();
         auto legacy_settings_it = legacy_map.find(key);
         if (legacy_settings_it != legacy_map.end())
         {
@@ -1052,11 +1052,11 @@ LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default
 F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value) const
 {
     LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
-    const auto& settings_map = mSettings.map();
+    const auto& settings_map = mSettings.asMap();
     auto legacy_it = settings_map.find(SETTING_LEGACY_HAZE);
     if (legacy_it != settings_map.end())
     {
-        const auto& legacy_map = legacy_it->second.map();
+        const auto& legacy_map = legacy_it->second.asMap();
         auto legacy_settings_it = legacy_map.find(key);
         if (legacy_settings_it != legacy_map.end())
         {
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 52bf38d3afa890da0e0847862d00c0f303c0b001..debf87aafc572b5b1177a565a9f76812a4217b28 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -222,7 +222,7 @@ void LLAvatarNameCache::handleAvNameCacheSuccess(const LLSD &data, const LLSD &h
     F64 now = LLFrameTimer::getTotalSeconds();
 
     const LLSD& agents = data["agents"];
-    for (const LLSD& row : agents.array())
+    for (const LLSD& row : agents.asArray())
     {
         LLUUID agent_id = row["id"].asUUID();
 
@@ -249,7 +249,7 @@ void LLAvatarNameCache::handleAvNameCacheSuccess(const LLSD &data, const LLSD &h
         LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; "
             << "expires in " << expires - now << " seconds"
             << LL_ENDL;
-        for (const LLSD& llsd_val : unresolved_agents.array())
+        for (const LLSD& llsd_val : unresolved_agents.asArray())
         {
             const LLUUID& agent_id = llsd_val.asUUID();
 
@@ -489,7 +489,7 @@ bool LLAvatarNameCache::importFile(std::istream& istr)
 
 	LLUUID agent_id;
 	LLAvatarName av_name;
-	for (const auto& llsd_pair : agents.map())
+	for (const auto& llsd_pair : agents.asMap())
 	{
 		agent_id.set(llsd_pair.first);
 		av_name.fromLLSD(llsd_pair.second );
diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index 945453230625fcf4ce7d0591e9b8ada70ee89ce1..682260633a99e4284ca5f5e58c94f8f21a85a1ed 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -372,7 +372,7 @@ void LLMaterial::fromLLSD(const LLSD& material_data)
 {
     if (!material_data.isMap()) return;
 
-    const auto& material_map = material_data.map();
+    const auto& material_map = material_data.asMap();
     const auto& material_end = material_map.end();
 
     auto it = material_map.find(MATERIALS_CAP_NORMAL_MAP_FIELD);
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 5517159a2d9c0e7367d50699478efb9d9e29ee9c..28f36c0387e9c71893f98f2715b19e221e2745f4 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1172,7 +1172,7 @@ bool LLModel::loadModel(std::istream& is)
 		}
 	}
 	
-	const auto& header_map = header.map();
+	const auto& header_map = header.asMap();
 
 	auto it = header_map.find("material_list");
 	if (it != header_map.end())
@@ -1460,13 +1460,13 @@ LLMeshSkinInfo::LLMeshSkinInfo(const LLUUID& mesh_id, const LLSD& skin) :
 
 void LLMeshSkinInfo::fromLLSD(const LLSD& skin)
 {
-	const auto& skin_map = skin.map();
+	const auto& skin_map = skin.asMap();
 
 	auto it = skin_map.find("joint_names");
 	if (it != skin_map.end())
 	{
 		const auto& joint_names = it->second;
-		for(const auto& jnt_llsd : joint_names.array())
+		for(const auto& jnt_llsd : joint_names.asArray())
 		{
 			mJointNames.emplace_back(jnt_llsd.asString());
 			mJointNums.emplace_back(-1);
@@ -1476,7 +1476,7 @@ void LLMeshSkinInfo::fromLLSD(const LLSD& skin)
 	it = skin_map.find("bind_shape_matrix");
 	if (it != skin_map.end())
 	{
-		const auto& bind_shape_mat = it->second.array();
+		const auto& bind_shape_mat = it->second.asArray();
 		LLMatrix4 mat;
 		for (auto j = 0; j < 4; j++)
 		{
@@ -1491,7 +1491,7 @@ void LLMeshSkinInfo::fromLLSD(const LLSD& skin)
 	it = skin_map.find("inverse_bind_matrix");
 	if (it != skin_map.end())
 	{
-		const auto& inv_bind_mat = it->second.array();
+		const auto& inv_bind_mat = it->second.asArray();
 		for (size_t i = 0, size = inv_bind_mat.size(); i < size; ++i)
 		{
 			LLMatrix4 mat;
@@ -1523,7 +1523,7 @@ void LLMeshSkinInfo::fromLLSD(const LLSD& skin)
 	it = skin_map.find("alt_inverse_bind_matrix");
 	if (it != skin_map.end())
 	{
-		const auto& alt_inv_bind_mat = it->second.array();
+		const auto& alt_inv_bind_mat = it->second.asArray();
 		for (size_t i = 0, size = alt_inv_bind_mat.size(); i < size; ++i)
 		{
 			LLMatrix4 mat;
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index c155d92e6a2b5d1daf85b95f59d85b0eca5be4e7..9e06857e951f3325271f305557c58f5def785b77 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1029,7 +1029,7 @@ void LLShaderMgr::initShaderCache(bool enabled, const LLUUID& old_cache_version,
 
 			if (old_cache_version == current_cache_version)
 			{
-				for (const auto& data_pair : in_data.map())
+				for (const auto& data_pair : in_data.asMap())
 				{
 					ProgramBinaryData binary_info = ProgramBinaryData();
 					binary_info.mBinaryFormat = data_pair.second["binary_format"].asInteger();
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index 5f3397845bf96aaeefb0f0eba02263c39c9c5fbe..6b6d50288c8be72d401dae5d2c7499ce1dab9829 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -254,7 +254,7 @@ void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color)
 	LLSD color_sd = color.getValue();
 	paragraph_color_segments[0]["color"]=color_sd;
 
-	for(const auto& color_segment_it : paragraph_color_segments.array())
+	for(const auto& color_segment_it : paragraph_color_segments.asArray())
 	{			
 		LLSD color_llsd = color_segment_it["color"];
 		std::string color_str  = color_segment_it["text"].asString();
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index ef9b7aeace08ee0cafd9072ee1ce4bb50aa12232..4d6c2f32c7b54607bf162bba1171607bb553660d 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -482,7 +482,7 @@ void LLFloaterReg::registerControlVariables()
 	}
 
 	const LLSD& exclude_list = LLUI::getInstance()->mSettingGroups["config"]->getLLSD("always_showable_floaters");
-	for (const auto& llsd_var : exclude_list.array())
+	for (const auto& llsd_var : exclude_list.asArray())
 	{
 		sAlwaysShowableList.insert(llsd_var.asString());
 	}
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 56b4e559a24ca6c42ab7805760980f06531340c8..26582bed1a5a82f2230b7a9813cbd645184d21b6 100644
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -137,11 +137,11 @@ std::string LLKeywords::getArguments(LLSD& arguments)
 	if (arguments.isArray())
 	{
 		U32 argsCount = arguments.size();
-		for (const LLSD& args : arguments.array())
+		for (const LLSD& args : arguments.asArray())
 		{
 			if (args.isMap())
 			{
-				for (const auto& llsd_pair : args.map())
+				for (const auto& llsd_pair : args.asMap())
 				{
 					argString += llsd_pair.second.get("type").asString() + " " + llsd_pair.first;
 					if (argsCount-- > 1)
@@ -290,7 +290,7 @@ void LLKeywords::processTokens()
 	addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "/*", syntax_lsl_comment_color, "Comment (multi-line)\nNon-functional commentary or disabled code", "*/" );
 	addToken(LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS, "\"", syntax_lsl_comment_color, "String literal", "\"" );
 
-	for (const auto& llsd_pair : mSyntax.map())
+	for (const auto& llsd_pair : mSyntax.asMap())
 	{
 		if (llsd_pair.first == "llsd-lsl-syntax-version")
 		{
@@ -354,13 +354,13 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, std::string_view group)
 
 	if (tokens.isMap())
 	{
-		for (const auto& token_pair : tokens.map())
+		for (const auto& token_pair : tokens.asMap())
 		{
 			if (token_pair.second.isMap())
 			{
 				mAttributes.clear();
 				LLSD arguments = LLSD();
-				for (const auto& token_inner_pair : token_pair.second.map())
+				for (const auto& token_inner_pair : token_pair.second.asMap())
 				{
 					if (token_inner_pair.first == "arguments")
 					{ 
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 42f98fd532980ebd88491e4af29f9cfaadd21b90..1bac017fc771b07ec6bf0f1bf81341a9103b4767 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -268,7 +268,7 @@ LLSD LLNotificationForm::asLLSD() const
 
 LLSD LLNotificationForm::getElement(std::string_view element_name)
 {
-	for (const LLSD& llsd_val : mFormData.array())
+	for (const LLSD& llsd_val : mFormData.asArray())
 	{
 		if (llsd_val["name"].asString() == element_name) return llsd_val;
 	}
@@ -278,7 +278,7 @@ LLSD LLNotificationForm::getElement(std::string_view element_name)
 
 bool LLNotificationForm::hasElement(std::string_view element_name) const
 {
-	for (const LLSD& llsd_val : mFormData.array())
+	for (const LLSD& llsd_val : mFormData.asArray())
 	{
 		if (llsd_val["name"].asString() == element_name) return true;
 	}
@@ -300,7 +300,7 @@ void LLNotificationForm::getElements(LLSD& elements, S32 offset)
 
 bool LLNotificationForm::getElementEnabled(std::string_view element_name) const
 {
-	for (const LLSD& llsd_val : mFormData.array())
+	for (const LLSD& llsd_val : mFormData.asArray())
 	{
 		if (llsd_val["name"].asString() == element_name)
 		{
@@ -313,7 +313,7 @@ bool LLNotificationForm::getElementEnabled(std::string_view element_name) const
 
 void LLNotificationForm::setElementEnabled(std::string_view element_name, bool enabled)
 {
-	for (LLSD& llsd_val : mFormData.array())
+	for (LLSD& llsd_val : mFormData.asArray())
 	{
 		if (llsd_val["name"].asString() == element_name)
 		{
@@ -339,7 +339,7 @@ void LLNotificationForm::append(const LLSD& sub_form)
 {
 	if (sub_form.isArray())
 	{
-		for (const auto& llsd_val : sub_form.array())
+		for (const auto& llsd_val : sub_form.asArray())
 		{
 			mFormData.append(llsd_val);
 		}
@@ -348,7 +348,7 @@ void LLNotificationForm::append(const LLSD& sub_form)
 
 void LLNotificationForm::formatElements(const LLSD& substitutions)
 {
-	for (LLSD& llsd_val : mFormData.array())
+	for (LLSD& llsd_val : mFormData.asArray())
 	{
 		// format "text" component of each form element
 		if (llsd_val.has("text"))
@@ -368,7 +368,7 @@ void LLNotificationForm::formatElements(const LLSD& substitutions)
 
 std::string LLNotificationForm::getDefaultOption()
 {
-	for (const LLSD& llsd_val : mFormData.array())
+	for (const LLSD& llsd_val : mFormData.asArray())
 	{
 		if (llsd_val["default"]) return llsd_val["name"].asString();
 	}
@@ -648,7 +648,7 @@ S32 LLNotification::getSelectedOption(const LLSD& notification, const LLSD& resp
 //static
 std::string LLNotification::getSelectedOptionName(const LLSD& response)
 {
-	for (const auto& llsd_pair : response.map())
+	for (const auto& llsd_pair : response.asMap())
 	{
 		if (llsd_pair.second.isBoolean() && llsd_pair.second.asBoolean())
 		{
diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp
index f432cef46ee3c02c4f8efaf7359364cca4578a81..daf85493f97c88e5e0ed7174ba867512862a2699 100644
--- a/indra/llui/lltextparser.cpp
+++ b/indra/llui/lltextparser.cpp
@@ -402,7 +402,7 @@ bool LLTextParser::loadKeywords()
 		return false;
 	}
 
-	for (const LLSD& sdEntry : sdIn.array())
+	for (const LLSD& sdEntry : sdIn.asArray())
 	{
 		mHighlightEntries.push_back(LLHighlightEntry(sdEntry));
 	}
diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp
index 9d0dc1d013d154b033bd783f01223c9917d84b6b..5e1ced247df7c0a8c23070e2d74c56b4e13ab8a0 100644
--- a/indra/llui/lluistring.cpp
+++ b/indra/llui/lluistring.cpp
@@ -70,7 +70,7 @@ void LLUIString::setArgs(const LLSD& sd)
 	LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
 	
 	if (!sd.isMap()) return;
-	for(const auto& llsd_pair : sd.map())
+	for(const auto& llsd_pair : sd.asMap())
 	{
 		setArg(llsd_pair.first, llsd_pair.second.asString());
 	}
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index 3a2eb513f885872384aca7af59788b662d4e11b3..82f759f8dcb3fde07f35a47b4d0c4dcc1486dff4 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -1106,7 +1106,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v
 	U32	validitems = 0;
 	bool hidefromsettingseditor = false;
 	
-	for(const auto& e : settings.map())
+	for(const auto& e : settings.asMap())
 	{
 		LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT;
 		std::string const & name = e.first;
diff --git a/indra/newview/alrenderutils.cpp b/indra/newview/alrenderutils.cpp
index b4da83bdd8481829967bab32b233a4e45b393807..28a5d0c2d235dbcf74bdb4ea8874d21a13ddee17 100644
--- a/indra/newview/alrenderutils.cpp
+++ b/indra/newview/alrenderutils.cpp
@@ -91,7 +91,7 @@ freely, subject to the following restrictions:
 
 3. This notice may not be removed or altered from any source distribution.
 */
- 
+
 /*
    reads .cube files
    returns a vector of bytes
@@ -316,7 +316,7 @@ void ALRenderUtil::refreshState()
 bool ALRenderUtil::setupTonemap()
 {
 	mTonemapType = gSavedSettings.getU32("RenderToneMapType");
-	if (mTonemapType >= TONEMAP_COUNT || (mTonemapType == ALTonemap::TONEMAP_AMD && (gGLManager.mGLVersion < 4.20f || !gDeferredPostTonemapLPMProgram.isComplete())))
+	if (mTonemapType >= TONEMAP_COUNT || (mTonemapType == ALTonemap::TONEMAP_AMD &&  !gDeferredPostTonemapLPMProgram.isComplete()))
 	{
 		mTonemapType = ALTonemap::TONEMAP_ACES_HILL;
 	}
@@ -647,17 +647,17 @@ void ALRenderUtil::renderColorGrade(LLRenderTarget* src, LLRenderTarget* dst)
 	static LLCachedControl<bool> no_post(gSavedSettings, "RenderDisablePostProcessing", false);
 	static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
 	LLGLSLShader* tone_shader = nullptr;
-	if (mCGLut != 0 )
+	if (mCGLut != 0)
 	{
 		tone_shader = no_post && gFloaterTools->isAvailable() ? &gDeferredPostColorCorrectLUTProgram[2] : // no post (no gamma, no exposure, no tonemapping)
-        LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? &gDeferredPostColorCorrectLUTProgram[1] :
-        &gDeferredPostColorCorrectLUTProgram[0];
+			LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? &gDeferredPostColorCorrectLUTProgram[1] :
+			&gDeferredPostColorCorrectLUTProgram[0];
 	}
 	else
 	{
-	    tone_shader = no_post && gFloaterTools->isAvailable() ? &gDeferredPostColorCorrectProgram[2] : // no post (no gamma, no exposure, no tonemapping)
-        LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? &gDeferredPostColorCorrectProgram[1] :
-        &gDeferredPostColorCorrectProgram[0];
+		tone_shader = no_post && gFloaterTools->isAvailable() ? &gDeferredPostColorCorrectProgram[2] : // no post (no gamma, no exposure, no tonemapping)
+			LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance(should_auto_adjust) == 0.f ? &gDeferredPostColorCorrectProgram[1] :
+			&gDeferredPostColorCorrectProgram[0];
 	}
 
 	tone_shader->bind();
@@ -701,9 +701,17 @@ bool ALRenderUtil::setupSharpen()
 	if (LLPipeline::sRenderDeferred)
 	{
 		mSharpenMethod = gSavedSettings.getU32("RenderSharpenMethod");
-		if (mSharpenMethod >= SHARPEN_COUNT 
-			|| (mSharpenMethod == ALSharpen::SHARPEN_CAS && (gGLManager.mGLVersion < 4.2f || !gDeferredPostCASProgram.isComplete())) 
-			|| (mSharpenMethod == ALSharpen::SHARPEN_DLS && !gDeferredPostDLSProgram.isComplete()))
+		if (mSharpenMethod >= SHARPEN_COUNT)
+		{
+			mSharpenMethod = ALSharpen::SHARPEN_CAS;
+		}
+
+		if (mSharpenMethod == ALSharpen::SHARPEN_CAS && !gDeferredPostCASProgram.isComplete())
+		{
+			mSharpenMethod = ALSharpen::SHARPEN_DLS;
+		}
+
+		if (mSharpenMethod == ALSharpen::SHARPEN_DLS && !gDeferredPostDLSProgram.isComplete())
 		{
 			mSharpenMethod = ALSharpen::SHARPEN_NONE;
 		}
@@ -783,7 +791,7 @@ void ALRenderUtil::renderSharpen(LLRenderTarget* src, LLRenderTarget* dst)
 
 		sharpen_shader->uniform4uiv(cas_param_0, 1, const0);
 		sharpen_shader->uniform4uiv(cas_param_1, 1, const1);
-		
+
 		sharpen_shader->uniform2f(out_screen_res, dst->getWidth(), dst->getHeight());
 	}
 
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index dbc5bcb178d945ec74b201eac2e886352738118c..a2a6ad2b29243c963780796f57caa337d5e9e273 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -286,7 +286,7 @@ class LLChatHistoryHeader: public LLPanel
 				LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(participant_uuid);
 				if (mi != gdatap->mMembers.end())
 				{
-					LLGroupMemberData* member_data = (*mi).second;
+					LLGroupMemberData* member_data = (*mi).second.get();
 					// Is the member an owner?
 					if (member_data && member_data->isInRole(gdatap->mOwnerRole))
 					{
diff --git a/indra/newview/llderenderlist.cpp b/indra/newview/llderenderlist.cpp
index 528d8f3e83164e4eca79e08ccbbdbb1490df2657..d7be63f5ddaa2c17bf39528ac5707b431b48d632 100644
--- a/indra/newview/llderenderlist.cpp
+++ b/indra/newview/llderenderlist.cpp
@@ -177,7 +177,7 @@ void LLDerenderList::load()
 		return;
 	}
 
-	for (const LLSD& sdEntry : inSD.array())
+	for (const LLSD& sdEntry : inSD.asArray())
 	{
 		auto pEntry = LLDerenderEntry::fromLLSD(sdEntry);
 		if (pEntry->isValid())
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 7bc45ffc46f6454eaa2000e1571264b22f1c9919..853ed090e562164d1bd5b73a7f03d9f3b2a1df9c 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -1683,7 +1683,7 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
     LLShaderUniforms* shader = &uniforms[LLGLSLShader::SG_ANY];
     //_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
     const LLSettingsBase::parammapping_t& params = psetting->getParameterMap();
-    const auto& settings_map = psetting->mSettings.map();
+    const auto& settings_map = psetting->mSettings.asMap();
     for (const auto &it: params)
     {
         LLSD value;
@@ -1691,7 +1691,7 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
         auto legacy_haze_it = settings_map.find(LLSettingsSky::SETTING_LEGACY_HAZE);
         if (legacy_haze_it != settings_map.end())
         {
-            const auto& legacy_map = legacy_haze_it->second.map();
+            const auto& legacy_map = legacy_haze_it->second.asMap();
             auto legacy_setting_it = legacy_map.find(it.first);
             if (legacy_setting_it != legacy_map.end())
             {
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 46fd7944d74ef38b4424467d81fa84c621d0e7f3..6d41754195d7e5c3b933224b70ebb40151fa0c27 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -2116,7 +2116,7 @@ bool LLFloaterIMContainer::canBanSelectedMember(const LLUUID& participant_uuid)
 			LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find((participant_uuid));
 			if (mi != gdatap->mMembers.end())
 			{
-				LLGroupMemberData* member_data = (*mi).second;
+				LLGroupMemberData* member_data = (*mi).second.get();
 				// Is the member an owner?
 				if (member_data && member_data->isInRole(gdatap->mOwnerRole))
 				{
diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp
index 09b8279025726dfb899625066b8293d7edfc547e..5cd5f69d09e8f180413d3586e9fba2a24c17daed 100644
--- a/indra/newview/llfloaterimsession.cpp
+++ b/indra/newview/llfloaterimsession.cpp
@@ -1190,7 +1190,7 @@ void LLFloaterIMSession::processAgentListUpdates(const LLSD& body)
 	if (body.isMap() && body.has("agent_updates") && body["agent_updates"].isMap())
 	{
 		LLSD::map_const_iterator update_it;
-		for(const auto& agent_update : body["agent_updates"].map())
+		for(const auto& agent_update : body["agent_updates"].asMap())
 		{
 			LLUUID agent_id(agent_update.first);
 			LLSD agent_data = agent_update.second;
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 2ec19d50d41a9b80e6df606eadbba629f978f0be..3795e0db2e257345008b19be2105941ed7a41ca8 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -3555,7 +3555,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
 
 		allowed_agent_name_list->clearSortOrder();
 		allowed_agent_name_list->deleteAllItems();
-		for (const auto& llsd_val : result["AllowedAgents"].array())
+		for (const auto& llsd_val : result["AllowedAgents"].asArray())
 		{ 
 			LLUUID id = llsd_val["id"].asUUID();
 			allowed_agent_name_list->addNameItem(id);
@@ -3574,7 +3574,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
 
 		banned_agent_name_list->clearSortOrder();
 		banned_agent_name_list->deleteAllItems();
-		for (const auto& llsd_val : result["BannedAgents"].array())
+		for (const auto& llsd_val : result["BannedAgents"].asArray())
 		{
 			LLSD item;
 			item["id"] = llsd_val["id"].asUUID();
@@ -3617,7 +3617,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
 
 		allowed_group_name_list->clearSortOrder();
 		allowed_group_name_list->deleteAllItems();
-		for (const auto& llsd_val : result["AllowedGroups"].array())
+		for (const auto& llsd_val : result["AllowedGroups"].asArray())
 		{
 			LLUUID id = llsd_val["id"].asUUID();
 			allowed_group_name_list->addGroupNameItem(id);
@@ -3636,7 +3636,7 @@ void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
 
 		estate_manager_name_list->clearSortOrder();
 		estate_manager_name_list->deleteAllItems();
-		for (const auto& llsd_val : result["Managers"].array())
+		for (const auto& llsd_val : result["Managers"].asArray())
 		{
 			LLUUID id = llsd_val["agent_id"].asUUID();
 			estate_manager_name_list->addNameItem(id);
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index 21b080f26e26b6f481121ce01c86d76162a21f2a..1d032a711bf90fe3c14e8abec200a495e1396b33 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -379,7 +379,7 @@ void LLGroupActions::processLeaveGroupDataResponse(const LLUUID group_id)
 	//get the member data for the group
 	if ( mit != gdatap->mMembers.end() )
 	{
-		LLGroupMemberData* member_data = (*mit).second;
+		LLGroupMemberData* member_data = (*mit).second.get();
 
 		if ( member_data && member_data->isOwner() && gdatap->mMemberCount == 1)
 		{
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index f95d37ddb8e8cbf2f6af80097bba1b226520156d..1792af64f978a3d4e958e354d9c3ec91cfd43732 100644
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -405,10 +405,6 @@ void LLGroupMgrGroupData::removeData()
 
 void LLGroupMgrGroupData::removeMemberData()
 {
-	for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi)
-	{
-		delete mi->second;
-	}
 	mMembers.clear();
 	mMemberDataComplete = false;
 	mMemberVersion.generate();
@@ -418,18 +414,13 @@ void LLGroupMgrGroupData::removeRoleData()
 {
 	for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi)
 	{
-		LLGroupMemberData* data = mi->second;
+		LLGroupMemberData* data = mi->second.get();
 		if (data)
 		{
 			data->clearRoles();
 		}
 	}
 
-	for (role_list_t::iterator ri = mRoles.begin(); ri != mRoles.end(); ++ri)
-	{
-		LLGroupRoleData* data = ri->second;
-		delete data;
-	}
 	mRoles.clear();
 	mReceivedRoleMemberPairs = 0;
 	mRoleDataComplete = false;
@@ -440,7 +431,7 @@ void LLGroupMgrGroupData::removeRoleMemberData()
 {
 	for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi)
 	{
-		LLGroupMemberData* data = mi->second;
+		LLGroupMemberData* data = mi->second.get();
 		if (data)
 		{
 			data->clearRoles();
@@ -449,7 +440,7 @@ void LLGroupMgrGroupData::removeRoleMemberData()
 
 	for (role_list_t::iterator ri = mRoles.begin(); ri != mRoles.end(); ++ri)
 	{
-		LLGroupRoleData* data = ri->second;
+		LLGroupRoleData* data = ri->second.get();
 		if (data)
 		{
 			data->clearMembers();
@@ -480,8 +471,8 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id,
 		return false;
 	}
 
-	LLGroupRoleData* grd = ri->second;
-	LLGroupMemberData* gmd = mi->second;
+	LLGroupRoleData* grd = ri->second.get();
+	LLGroupMemberData* gmd = mi->second.get();
 
 	if (!grd || !gmd)
 	{
@@ -554,12 +545,9 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id,
 
 void LLGroupMgrGroupData::recalcAllAgentPowers()
 {
-	LLGroupMemberData* gmd;
-
-	for (member_list_t::iterator mit = mMembers.begin();
-		 mit != mMembers.end(); ++mit)
+	for (const auto& member_pair : mMembers)
 	{
-		gmd = mit->second;
+		LLGroupMemberData* gmd = member_pair.second.get();
 		if (!gmd) continue;
 
 		gmd->mAgentPowers = 0;
@@ -579,7 +567,7 @@ void LLGroupMgrGroupData::recalcAgentPowers(const LLUUID& agent_id)
 	member_list_t::iterator mi = mMembers.find(agent_id);
 	if (mi == mMembers.end()) return;
 
-	LLGroupMemberData* gmd = mi->second;
+	LLGroupMemberData* gmd = mi->second.get();
 
 	if (!gmd) return;
 
@@ -635,7 +623,6 @@ bool packRoleUpdateMessageBlock(LLMessageSystem* msg,
 void LLGroupMgrGroupData::sendRoleChanges()
 {
 	// Commit changes locally
-	LLGroupRoleData* grd;
 	role_list_t::iterator role_it;
 	LLMessageSystem* msg = gMessageSystem;
 	bool start_message = true;
@@ -668,15 +655,12 @@ void LLGroupMgrGroupData::sendRoleChanges()
 			case RC_CREATE:
 			{
 				// NOTE: role_it is NOT valid in this case
-				grd = new LLGroupRoleData(role_id, role_data, 0);
-				mRoles[role_id] = grd;
+				mRoles[role_id] = std::make_unique<LLGroupRoleData>(role_id, role_data, 0);
 				need_role_data = true;
 				break;
 			}
 			case RC_DELETE:
 			{
-				LLGroupRoleData* group_role_data = (*role_it).second;
-				delete group_role_data;
 				mRoles.erase(role_it);
 				need_role_cleanup = true;
 				need_power_recalc = true;
@@ -691,7 +675,7 @@ void LLGroupMgrGroupData::sendRoleChanges()
 				// fall through
 			default: 
 			{
-				LLGroupRoleData* group_role_data = (*role_it).second;
+				LLGroupRoleData* group_role_data = (*role_it).second.get();
 				group_role_data->setRoleData(role_data); // NOTE! might modify mRoleChanges!
 				break;
 			}
@@ -786,7 +770,7 @@ void LLGroupMgrGroupData::banMemberById(const LLUUID& participant_uuid)
 
 	mPendingBanRequest = false;
 
-	LLGroupMemberData* member_data = (*mi).second;
+	LLGroupMemberData* member_data = (*mi).second.get();
 	if (member_data && member_data->isInRole(mOwnerRole))
 	{
 		return; // can't ban group owner
@@ -987,7 +971,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data)
 				}
 				
 				//LL_INFOS() << "Member " << member_id << " has powers " << std::hex << agent_powers << std::dec << LL_ENDL;
-				LLGroupMemberData* newdata = new LLGroupMemberData(member_id, 
+				auto newdata = std::make_unique<LLGroupMemberData>(member_id, 
 																	contribution, 
 																	agent_powers, 
 																	title,
@@ -1000,7 +984,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data)
 					LL_INFOS() << " *** Received duplicate member data for agent " << member_id << LL_ENDL;
 				}
 #endif
-				group_datap->mMembers[member_id] = newdata;
+				group_datap->mMembers[member_id] = std::move(newdata);
 			}
 			else
 			{
@@ -1184,8 +1168,7 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data)
 
 
         LL_DEBUGS("GrpMgr") << "Adding role data: " << name << " {" << role_id << "}" << LL_ENDL;
-		LLGroupRoleData* rd = new LLGroupRoleData(role_id,name,title,desc,powers,member_count);
-		group_datap->mRoles[role_id] = rd;
+		group_datap->mRoles[role_id] = std::make_unique<LLGroupRoleData>(role_id, name, title, desc, powers, member_count);
 	}
 
 	if (group_datap->mRoles.size() == (U32)group_datap->mRoleCount)
@@ -1258,14 +1241,14 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data)
 				ri = group_datap->mRoles.find(role_id);
 				if (ri != group_datap->mRoles.end())
 				{
-					rd = ri->second;
+					rd = ri->second.get();
 				}
 
 				md = NULL;
 				mi = group_datap->mMembers.find(member_id);
 				if (mi != group_datap->mMembers.end())
 				{
-					md = mi->second;
+					md = mi->second.get();
 				}
 
 				if (rd && md)
@@ -1288,7 +1271,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data)
 	if (group_datap->mReceivedRoleMemberPairs == total_pairs)
 	{
 		// Add role data for the 'everyone' role to all members
-		LLGroupRoleData* everyone = group_datap->mRoles[LLUUID::null];
+		LLGroupRoleData* everyone = group_datap->mRoles[LLUUID::null].get();
 		if (!everyone)
 		{
 			LL_WARNS() << "Everyone role not found!" << LL_ENDL;
@@ -1298,7 +1281,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data)
 			for (LLGroupMgrGroupData::member_list_t::iterator mi = group_datap->mMembers.begin();
 				 mi != group_datap->mMembers.end(); ++mi)
 			{
-				LLGroupMemberData* data = mi->second;
+				LLGroupMemberData* data = mi->second.get();
 				if (data)
 				{
 					data->addRole(LLUUID::null,everyone);
@@ -1906,11 +1889,8 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
 	LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
 	if (!group_datap) return;
 
-	for (uuid_vec_t::iterator it = member_ids.begin();
-		 it != member_ids.end(); ++it)
+	for (const LLUUID& ejected_member_id : member_ids)
 	{
-		LLUUID& ejected_member_id = (*it);
-
 		// Can't use 'eject' to leave a group.
 		if (ejected_member_id == gAgent.getID()) continue;
 
@@ -1939,23 +1919,21 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
 				start_message = true;
 			}
 
-			LLGroupMemberData* member_data = (*mit).second;
-
-			// Clean up groupmgr
-			for (LLGroupMemberData::role_list_t::iterator rit = member_data->roleBegin();
-				 rit != member_data->roleEnd(); ++rit)
 			{
-				if ((*rit).first.notNull() && (*rit).second!=0)
+				LLGroupMemberData* member_data = (*mit).second.get();
+
+				// Clean up groupmgr
+				for (LLGroupMemberData::role_list_t::iterator rit = member_data->roleBegin();
+					rit != member_data->roleEnd(); ++rit)
 				{
-					(*rit).second->removeMember(ejected_member_id);
+					if ((*rit).first.notNull() && (*rit).second != 0)
+					{
+						(*rit).second->removeMember(ejected_member_id);
+					}
 				}
 			}
 			
 			group_datap->mMembers.erase(ejected_member_id);
-			
-			// member_data was introduced and is used here instead of (*mit).second to avoid crash because of invalid iterator
-			// It becomes invalid after line with erase above. EXT-4778
-			delete member_data;
 		}
 	}
 
@@ -2255,65 +2233,83 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
 	// Compute this once, rather than every time.
 	U64	default_powers	= llstrtou64(defaults["default_powers"].asString().c_str(), NULL, 16);
 
+	const std::string group_member_status_online = LLTrans::getString("group_member_status_online");
+	const std::string default_title = titles[0].asString();
+
 	LLSD::map_const_iterator member_iter_start	= member_list.beginMap();
 	LLSD::map_const_iterator member_iter_end	= member_list.endMap();
 	for( ; member_iter_start != member_iter_end; ++member_iter_start)
 	{
-		// Reset defaults
-		online_status	= "unknown";
-		title			= titles[0].asString();
-		contribution	= 0;
-		member_powers	= default_powers;
-		is_owner		= false;
+		if (!member_iter_start->second.isMap()) continue;
 
 		const LLUUID member_id(member_iter_start->first);
-		LLSD member_info = member_iter_start->second;
-		
-		if(member_info.has("last_login"))
+		const auto& member_info = member_iter_start->second.asMap();
+		const auto member_info_end = member_info.end();
+
+		auto it = member_info.find("last_login");
+		if(it != member_info_end)
 		{
-			online_status = member_info["last_login"].asString();
+			online_status = it->second.asString();
 			if(online_status == "Online")
-				online_status = LLTrans::getString("group_member_status_online");
+				online_status = group_member_status_online;
 			else
 				formatDateString(online_status);
 		}
+		else
+		{
+			online_status = "unknown";
+		}
 
-		if(member_info.has("title"))
-			title = titles[member_info["title"].asInteger()].asString();
+		it = member_info.find("title");
+		if (it != member_info_end)
+			title = titles[it->second.asInteger()].asString();
+		else
+			title = default_title;
 
-		if(member_info.has("powers"))
-			member_powers = llstrtou64(member_info["powers"].asString().c_str(), NULL, 16);
+		it = member_info.find("powers");
+		if (it != member_info_end)
+			member_powers = llstrtou64(it->second.asString().c_str(), NULL, 16);
+		else
+			member_powers = default_powers;
 
-		if(member_info.has("donated_square_meters"))
-			contribution = member_info["donated_square_meters"];
+		it = member_info.find("donated_square_meters");
+		if (it != member_info_end)
+			contribution = it->second.asInteger();
+		else
+			contribution = 0;
 
-		if(member_info.has("owner"))
+		it = member_info.find("owner");
+		if (it != member_info_end)
 			is_owner = true;
+		else
+			is_owner = false;
 
-		LLGroupMemberData* data = new LLGroupMemberData(member_id, 
-			contribution, 
-			member_powers, 
-			title,
-			online_status,
-			is_owner);
-
-		LLGroupMemberData* member_old = group_datap->mMembers[member_id];
-		if (member_old && group_datap->mRoleMemberDataComplete)
+		LLGroupMemberData* member_old = group_datap->mMembers[member_id].get();
+		if (member_old)
 		{
-			LLGroupMemberData::role_list_t::iterator rit = member_old->roleBegin();
-			LLGroupMemberData::role_list_t::iterator end = member_old->roleEnd();
-
-			for ( ; rit != end; ++rit)
+			member_old->mID = member_id;
+			member_old->mContribution = contribution;
+			member_old->mAgentPowers = member_powers;
+			member_old->mTitle = std::move(title);
+			member_old->mOnlineStatus = std::move(online_status);
+			member_old->mIsOwner = is_owner;
+
+			if (!group_datap->mRoleMemberDataComplete)
 			{
-				data->addRole((*rit).first,(*rit).second);
+				member_old->mRolesList.clear();
 			}
 		}
 		else
 		{
 			group_datap->mRoleMemberDataComplete = false;
-		}
 
-		group_datap->mMembers[member_id] = data;
+			group_datap->mMembers[member_id] = std::make_unique<LLGroupMemberData>(member_id,
+				contribution,
+				member_powers,
+				title,
+				online_status,
+				is_owner);
+		}
 	}
 
 	group_datap->mMemberVersion.generate();
diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h
index 30b2aa35999e8abf10cc705416378e288679dad4..2fac45ece7d29791cfad98d85f24a471e47a2744 100644
--- a/indra/newview/llgroupmgr.h
+++ b/indra/newview/llgroupmgr.h
@@ -102,7 +102,8 @@ friend class LLGroupMgrGroupData;
 
 	BOOL isInRole(const LLUUID& role_id) { return (mRolesList.find(role_id) != mRolesList.end()); }
 
-private:
+	const role_list_t& getRoles() { return mRolesList; }
+
 	LLUUID	mID;
 	S32		mContribution;
 	U64		mAgentPowers;
@@ -273,8 +274,8 @@ friend class LLGroupMgr;
 	void banMemberById(const LLUUID& participant_uuid);
 	
 public:
-	typedef	boost::unordered_map<LLUUID, LLGroupMemberData*> member_list_t;
-	typedef	boost::unordered_map<LLUUID,LLGroupRoleData*> role_list_t;
+	typedef	boost::unordered_map<LLUUID, std::unique_ptr<LLGroupMemberData>> member_list_t;
+	typedef	boost::unordered_map<LLUUID, std::unique_ptr<LLGroupRoleData>> role_list_t;
 	typedef std::map<lluuid_pair,LLRoleMemberChange,lluuid_pair_less> change_map_t;
 	typedef boost::unordered_map<LLUUID,LLRoleData> role_data_map_t;
 	typedef boost::unordered_map<LLUUID,LLGroupBanData> ban_list_t;
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index e7a0b69f5efd88683831415b3b6bcf20f3402199..37637458a3406416cb4acb64ce07ea67b8606aec 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -3762,12 +3762,12 @@ void LLIMMgr::addPendingAgentListUpdates(
 		update_types.append("agent_updates");
 		update_types.append("updates");
 
-		for (const auto& update_type : update_types.array())
+		for (const auto& update_type : update_types.asArray())
 		{
 			//we only want to include the last update for a given agent
-			for (const auto& update_pair : updates[update_type.asStringRef()].map())
+			for (const auto& update_pair : updates[update_type.asString()].asMap())
 			{
-				mPendingAgentListUpdates[session_id.asString()][update_type.asStringRef()][update_pair.first] =
+				mPendingAgentListUpdates[session_id.asString()][update_type.asString()][update_pair.first] =
 					update_pair.second;
 			}
 		}
@@ -3780,7 +3780,7 @@ void LLIMMgr::addPendingAgentListUpdates(
 		//of agent_id -> "LEAVE"/"ENTER"
 
 		//only want to keep last update for each agent
-		for (const auto& update_pair : updates["updates"].map())
+		for (const auto& update_pair : updates["updates"].asMap())
 		{
 			mPendingAgentListUpdates[session_id.asString()]["updates"][update_pair.first] =
 				update_pair.second;
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 148718fad2144485ae531791451f6839b94ea58d..706c768250419b7b51be334858bd7b4b98f2d24e 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -1234,7 +1234,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res
 	{
 		LLSD folders(content["folders"]);
 		
-		for (const auto& folder_sd : folders.array())
+		for (const auto& folder_sd : folders.asArray())
 		{	
 			//LLUUID agent_id = folder_sd["agent_id"];
 
@@ -1256,7 +1256,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res
 				LLSD items(folder_sd["items"]);
 			    LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
 				
-				for (const auto& item : items.array())
+				for (const auto& item : items.asArray())
 			    {	
                     const LLUUID lost_uuid(gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND));
 
@@ -1284,7 +1284,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res
 			}
 
 			LLSD categories(folder_sd["categories"]);
-			for (const auto& category : categories.array())
+			for (const auto& category : categories.asArray())
 			{	
 				tcategory->fromLLSD(category); 
 				
@@ -1301,7 +1301,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res
 
 			LLSD items(folder_sd["items"]);
 			LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
-			for (const auto& item : items.array())
+			for (const auto& item : items.asArray())
 			{	
 				titem->unpackMessage(item);
 				
@@ -1322,7 +1322,7 @@ void BGFolderHttpHandler::processData(LLSD & content, LLCore::HttpResponse * res
 	if (content.has("bad_folders"))
 	{
 		LLSD bad_folders(content["bad_folders"]);
-		for (const auto& folder_sd : bad_folders.array())
+		for (const auto& folder_sd : bad_folders.asArray())
 		{
 			// These folders failed on the dataserver.  We probably don't want to retry them.
 			LL_WARNS(LOG_INV) << "Folder " << folder_sd["folder_id"].asString() 
@@ -1416,7 +1416,7 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http
 	if (false)
 	{
 		// timed out or curl failure
-		for (const auto& folder_sd : mRequestSD["folders"].array())
+		for (const auto& folder_sd : mRequestSD["folders"].asArray())
 		{
 			LLUUID folder_id(folder_sd["folder_id"].asUUID());
 			const BOOL recursive = getIsRecursive(folder_id);
@@ -1450,7 +1450,7 @@ void BGFolderHttpHandler::processFailure(const char * const reason, LLCore::Http
 	LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance();
 	if (true)
 	{
-		for (const auto& folder_sd : mRequestSD["folders"].array())
+		for (const auto& folder_sd : mRequestSD["folders"].asArray())
 		{
 			LLUUID folder_id(folder_sd["folder_id"].asUUID());
 			const BOOL recursive = getIsRecursive(folder_id);
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index c5526af89fc5ecdbb2157d4f18991d3f87fdd194..6990ba2fe0b5e248d644c0af37819dbfbf2e20ca 100644
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -933,7 +933,7 @@ void LLMarketplaceData::getSLMListingsCoro(LLUUID folderId)
     log_SLM_infos("Get /listings", static_cast<U32>(status.getType()), result);
 
     // Extract the info from the results
-    for (const LLSD& listing : result["listings"].array())
+    for (const LLSD& listing : result["listings"].asArray())
     { 
         int listingId = listing["id"].asInteger();
         bool isListed = listing["is_listed"].asBoolean();
@@ -1004,7 +1004,7 @@ void LLMarketplaceData::getSingleListingCoro(S32 listingId, LLUUID folderId)
 
 
     // Extract the info from the results
-    for (const LLSD& listing : result["listings"].array())
+    for (const LLSD& listing : result["listings"].asArray())
     {
         int resListingId = listing["id"].asInteger();
         bool isListed = listing["is_listed"].asBoolean();
@@ -1079,7 +1079,7 @@ void LLMarketplaceData::createSLMListingCoro(LLUUID folderId, LLUUID versionId,
     }
 
     // Extract the info from the results
-    for (const LLSD& listing : result["listings"].array())
+    for (const LLSD& listing : result["listings"].asArray())
     {
         int listingId = listing["id"].asInteger();
         bool isListed = listing["is_listed"].asBoolean();
@@ -1156,7 +1156,7 @@ void LLMarketplaceData::updateSLMListingCoro(LLUUID folderId, S32 listingId, LLU
     }
 
     // Extract the info from the Json string
-    for (const LLSD& listing : result["listings"].array())
+    for (const LLSD& listing : result["listings"].asArray())
     {
         int listing_id = listing["id"].asInteger();
         bool is_listed = listing["is_listed"].asBoolean();
@@ -1236,7 +1236,7 @@ void LLMarketplaceData::associateSLMListingCoro(LLUUID folderId, S32 listingId,
 
     log_SLM_infos("Put /associate_inventory", status.getType(), result);
 
-    for (const LLSD& listing : result["listings"].array())
+    for (const LLSD& listing : result["listings"].asArray())
     {
         int listing_id = listing["id"].asInteger();
         bool is_listed = listing["is_listed"].asBoolean();
@@ -1305,7 +1305,7 @@ void LLMarketplaceData::deleteSLMListingCoro(S32 listingId)
 
     log_SLM_infos("Delete /listing", status.getType(), result);
 
-    for (const LLSD& listing : result["listings"].array())
+    for (const LLSD& listing : result["listings"].asArray())
     {
         int listing_id = listing["id"].asInteger();
         LLUUID folder_id = LLMarketplaceData::instance().getListingFolder(listing_id);
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index 2b2b9408d7fa0021e16d0a5dc9ffa6c7a9a2b933..fd67aa2af857c84d42d0033abd4082a432451bd0 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -262,7 +262,7 @@ void LLPanelGroupInvite::impl::addRoleNames(LLGroupMgrGroupData* gdatap)
 	//get the member data for the agent if it exists
 	if (agent_iter != gdatap->mMembers.end())
 	{
-		member_data = (*agent_iter).second;
+		member_data = (*agent_iter).second.get();
 		if (member_data && mRoleNames)
 		{
 			is_owner = member_data->isOwner();
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index fbe53ec4edda4735cf8c43d5de7177f40ff88202..044affe4f5cb632e0967f0dc10f2ed1e0a33760c 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -87,7 +87,11 @@ bool agentCanAddToRole(const LLUUID& group_id,
 		return false;
 	}
 	
-	LLGroupMemberData* member_data = (*mi).second;
+	LLGroupMemberData* member_data = (*mi).second.get();
+	if (!member_data)
+	{
+		return false;
+	}
 
 	// Owners can add to any role.
 	if ( member_data->isInRole(gdatap->mOwnerRole) )
@@ -967,7 +971,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
 	{
 		// Count how many selected users are in this role.
 		const LLUUID& role_id = iter->first;
-		LLGroupRoleData* group_role_data = iter->second;
+		LLGroupRoleData* group_role_data = iter->second.get();
 
 		if (group_role_data)
 		{
@@ -1001,7 +1005,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
 					LLGroupMgrGroupData::member_list_t::iterator mi = 
 									gdatap->mMembers.find((*member_iter));
 					if (mi == gdatap->mMembers.end()) continue;
-					LLGroupMemberData* member_data = (*mi).second;
+					LLGroupMemberData* member_data = (*mi).second.get();
 					// Is the member an owner?
 					if ( member_data && member_data->isInRole(gdatap->mOwnerRole) )
 					{
@@ -1102,7 +1106,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
 		LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(gAgent.getID());
 		if (mi != gdatap->mMembers.end())
 		{
-			LLGroupMemberData* member_data = (*mi).second;
+			LLGroupMemberData* member_data = (*mi).second.get();
 
 			if ( member_data && member_data->isInRole(gdatap->mOwnerRole) )
 			{
@@ -1573,7 +1577,7 @@ U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& ag
 		return GP_NO_POWERS;
 	}
 
-	LLGroupMemberData* member_data = (*iter).second;
+	LLGroupMemberData* member_data = (*iter).second.get();
 	if (!member_data)
 	{
 		LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- Null member data for member with UUID " << agent_id << LL_ENDL;
@@ -1827,7 +1831,7 @@ void LLPanelGroupMembersSubTab::updateMembers()
 		{
 			if (matchesSearchFilter(av_name.getAccountName()))
 			{
-				addMemberToList(mMemberProgress->second);
+				addMemberToList(mMemberProgress->second.get());
 			}
 		}
 		else
@@ -1842,7 +1846,7 @@ void LLPanelGroupMembersSubTab::updateMembers()
 				}
 				mAvatarNameCacheConnections.erase(it);
 			}
-			mAvatarNameCacheConnections[mMemberProgress->first] = LLAvatarNameCache::get(mMemberProgress->first, boost::bind(&LLPanelGroupMembersSubTab::onNameCache, this, gdatap->getMemberVersion(), mMemberProgress->second, _2, _1));
+			mAvatarNameCacheConnections[mMemberProgress->first] = LLAvatarNameCache::get(mMemberProgress->first, boost::bind(&LLPanelGroupMembersSubTab::onNameCache, this, gdatap->getMemberVersion(), mMemberProgress->second.get(), _2, _1));
 		}
 	}
 
@@ -2436,7 +2440,7 @@ void LLPanelGroupRolesSubTab::buildMembersList()
 		LLGroupMgrGroupData::role_list_t::iterator rit = gdatap->mRoles.find(item->getUUID());
 		if (rit != gdatap->mRoles.end())
 		{
-			LLGroupRoleData* rdatap = (*rit).second;
+			LLGroupRoleData* rdatap = (*rit).second.get();
 			if (rdatap)
 			{
 				uuid_vec_t::const_iterator mit = rdatap->getMembersBegin();
@@ -2832,7 +2836,7 @@ void LLPanelGroupRolesSubTab::saveRoleChanges(bool select_saved_role)
 		{
 			role_members_count = gdatap->mMemberCount;
 		}
-		else if(LLGroupRoleData* grd = get_ptr_in_map(gdatap->mRoles, mSelectedRole))
+		else if(LLGroupRoleData* grd = gdatap->mRoles[mSelectedRole].get())
 		{
 			role_members_count = grd->getTotalMembersInRole();
 		}
@@ -3046,7 +3050,7 @@ void LLPanelGroupActionsSubTab::handleActionSelect()
 
 		for ( ; it != end; ++it)
 		{
-			gmd = (*it).second;
+			gmd = (*it).second.get();
 			if (!gmd) continue;
 			if ((gmd->getAgentPowers() & power_mask) == power_mask)
 			{
@@ -3067,7 +3071,7 @@ void LLPanelGroupActionsSubTab::handleActionSelect()
 
 		for ( ; it != end; ++it)
 		{
-			rmd = (*it).second;
+			rmd = (*it).second.get();
 			if (!rmd) continue;
 			if ((rmd->getRoleData().mRolePowers & power_mask) == power_mask)
 			{
@@ -3260,7 +3264,7 @@ void LLPanelGroupBanListSubTab::handleDeleteBanEntry()
 	LLGroupMgrGroupData::member_list_t::iterator mi = gdatap->mMembers.find(gAgent.getID());
 	if (mi != gdatap->mMembers.end())
 	{
-		LLGroupMemberData* member_data = (*mi).second;
+		LLGroupMemberData* member_data = (*mi).second.get();
 		if ( member_data && member_data->isInRole(gdatap->mOwnerRole) )
 		{
 			can_ban_members	= true;
diff --git a/indra/newview/llpipelinelistener.cpp b/indra/newview/llpipelinelistener.cpp
index 4f67984b027b0abc2a18162fab170f47b27c1dc0..ef9276cb41cfa6bf3fe34f5ae772f01a44376bea 100644
--- a/indra/newview/llpipelinelistener.cpp
+++ b/indra/newview/llpipelinelistener.cpp
@@ -41,7 +41,7 @@ namespace {
 	// Render Types
 	void toggle_render_types_wrapper(LLSD const& request)
 	{
-		for (const LLSD& llsd_val : request["types"].array())
+		for (const LLSD& llsd_val : request["types"].asArray())
 		{
 			U32 render_type = render_type_from_string( llsd_val.asString() );
 			if ( render_type != 0 )
@@ -78,7 +78,7 @@ namespace {
 	// Render Features
 	void toggle_render_features_wrapper(LLSD const& request)
 	{
-		for (const LLSD& llsd_val : request["features"].array())
+		for (const LLSD& llsd_val : request["features"].asArray())
 		{
 			U32 render_feature = feature_from_string( llsd_val.asString() );
 			if ( render_feature != 0 )
@@ -115,7 +115,7 @@ namespace {
 	// Render Info Displays
 	void toggle_info_displays_wrapper(LLSD const& request)
 	{
-		for (const LLSD& llsd_val : request["displays"].array())
+		for (const LLSD& llsd_val : request["displays"].asArray())
 		{
 			U64 info_display = info_display_from_string( llsd_val.asString() );
 			if ( info_display != 0 )
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index 27053b507a1bf83a9f858e2e313efbf03baf5ed4..485b8af58b07930fd28644097c211ec10787a5e6 100644
--- a/indra/newview/llslurl.cpp
+++ b/indra/newview/llslurl.cpp
@@ -412,7 +412,7 @@ std::string LLSLURL::getSLURLString() const
 		{
 			std::string app_url;
 			app_url += LLGridManager::getInstance()->getAppSLURLBase() + "/" + mAppCmd;
-			for(const LLSD& entry : mAppPath.array())
+			for(const LLSD& entry : mAppPath.asArray())
 			{
 				app_url += "/" + entry.asString();
 			}
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index f78d3dccbe60b4cf156c20a7bf025625a4f5b843..938666a487373d6958f7d187386dbfbd86809736 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -513,10 +513,10 @@ void LLSpeakerMgr::updateSpeakerList()
                     S32 updated = 0;
 					while (member_it != gdatap->mMembers.end())
 					{
-						LLGroupMemberData* member = member_it->second;
+						LLGroupMemberData* member = member_it->second.get();
                         LLUUID id = member_it->first;
 						// Add only members who are online and not already in the list
-						if ((member->getOnlineStatus() == "Online") && (mSpeakers.find(id) == mSpeakers.end()))
+						if ((member && member->getOnlineStatus() == "Online") && (mSpeakers.find(id) == mSpeakers.end()))
 						{
 							LLPointer<LLSpeaker> speakerp = setSpeaker(id, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT);
 							speakerp->mIsModerator = ((member->getAgentPowers() & GP_SESSION_MODERATOR) == GP_SESSION_MODERATOR);
@@ -677,7 +677,7 @@ void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers)
 
 	if ( speakers.has("agent_info") && speakers["agent_info"].isMap() )
 	{
-		for(const auto& llsd_pair : speakers["agent_info"].map())
+		for(const auto& llsd_pair : speakers["agent_info"].asMap())
 		{
 			const LLUUID agent_id(llsd_pair.first);
 
@@ -705,7 +705,7 @@ void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers)
 	{
 		//older, more decprecated way.  Need here for
 		//using older version of servers
-		for(const auto& llsd_val : speakers["agents"].array())
+		for(const auto& llsd_val : speakers["agents"].asArray())
 		{
 			const LLUUID agent_id = llsd_val.asUUID();
 
@@ -723,7 +723,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
 
 	if ( update.has("agent_updates") && update["agent_updates"].isMap() )
 	{
-		for(const auto& llsd_pair : update["agent_updates"].map())
+		for(const auto& llsd_pair : update["agent_updates"].asMap())
 		{
 			LLUUID agent_id(llsd_pair.first);
 			LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id);
@@ -775,7 +775,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
 	}
 	else if ( update.has("updates") && update["updates"].isMap() )
 	{
-		for (const auto& llsd_pair : update["updates"].map())
+		for (const auto& llsd_pair : update["updates"].asMap())
 		{
 			LLUUID agent_id(llsd_pair.first);
 			LLPointer<LLSpeaker> speakerp = findSpeaker(agent_id);
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 04eb687eb924dae10901c832d52719377da7266c..e3339d215b9b308871eb8a5fdde8f1d131fbf31e 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -6775,7 +6775,7 @@ void send_lures(const LLSD& notification, const LLSD& response)
 	msg->nextBlockFast(_PREHASH_Info);
 	msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in.
 	msg->addStringFast(_PREHASH_Message, text);
-	for(const auto& llsd_val : notification["payload"]["ids"].array())
+	for(const auto& llsd_val : notification["payload"]["ids"].asArray())
 	{
 		LLUUID target_id = llsd_val.asUUID();
 
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index f4b46153a358a574b05ae86938f4ca6c09c887b4..01b826627d299ccc86c081d3e5c1d6a1730004f1 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -346,7 +346,7 @@ bool LLGridManager::addGrid(LLSD& grid_data)
 										 <<"  login page:  "<<grid_data[GRID_LOGIN_PAGE_VALUE].asString()<<"\n"
 										 <<"  web profile: "<<grid_data[GRID_WEB_PROFILE_VALUE].asString()<<"\n";
 				/* still in LL_DEBUGS */ 
-				for (const LLSD& login_uris : grid_data[GRID_LOGIN_URI_VALUE].array())
+				for (const LLSD& login_uris : grid_data[GRID_LOGIN_URI_VALUE].asArray())
 				{
 					LL_CONT << "  login uri:   "<<login_uris.asString()<<"\n";
 				}
@@ -670,7 +670,7 @@ void LLGridManager::saveGridList()
 std::map<std::string, std::string> LLGridManager::getKnownGrids() const
 {
 	std::map<std::string, std::string> result;
-	for(const auto& grid_pair : mGridList.map())
+	for(const auto& grid_pair : mGridList.asMap())
 	{
 		// skip temp grids. since this is just for "grid label mappings for UI purposes"
 		if (grid_pair.second.has(GRID_TEMPORARY) && grid_pair.second[GRID_TEMPORARY].asBoolean())
@@ -738,7 +738,7 @@ std::string LLGridManager::getGrid(const std::string& grid) const
 	else
 	{
 		// search the grid list for a grid with a matching id
-		for(const auto& grid_pair : mGridList.map())
+		for(const auto& grid_pair : mGridList.asMap())
 		{
 			if (grid_pair.second.has(GRID_ID_VALUE))
 			{
@@ -773,7 +773,7 @@ std::string LLGridManager::getGridByProbing(const std::string& grid) const
 	else
 	{
 		// search the grid list for a grid with a matching id
-		for (const auto& grid_pair : mGridList.map())
+		for (const auto& grid_pair : mGridList.asMap())
 		{
 			if (grid_pair.second.has(GRID_ID_VALUE))
 			{
@@ -802,7 +802,7 @@ std::string LLGridManager::getGridByAttribute(const std::string& attribute, cons
 {
 	if (attribute.empty() || value.empty()) return LLStringUtil::null;
 	
-	for(const auto& grid_iter : mGridList.map())
+	for(const auto& grid_iter : mGridList.asMap())
 	{
 		if (grid_iter.second.has(attribute)
 			&& LLStringUtil::compareInsensitive(value, grid_iter.second[attribute].asString()) == 0)
@@ -871,7 +871,7 @@ void LLGridManager::getLoginURIs(const std::string& grid, std::vector<std::strin
 	{
         if (mGridList[grid_name][GRID_LOGIN_URI_VALUE].isArray())
         {
-		    for (const LLSD& llsd_uri : mGridList[grid_name][GRID_LOGIN_URI_VALUE].array())
+		    for (const LLSD& llsd_uri : mGridList[grid_name][GRID_LOGIN_URI_VALUE].asArray())
 		    {
 			    uris.push_back(llsd_uri.asString());
 		    }
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 725ac76c5a104561c982e1407467704bb073b198..586795ba25462055a490a861b4282c9ade8d878c 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -385,7 +385,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
             continue;
         }
 
-        for (const auto& iter : result.map())
+        for (const auto& iter : result.asMap())
         {
             regionp->setCapability(iter.first, iter.second);
 
@@ -495,7 +495,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle)
         // remove the http_result from the llsd
         result.erase("http_result");
 
-         for (const auto& llsd_pair : result.map())
+         for (const auto& llsd_pair : result.asMap())
         {
             regionp->setCapabilityDebug(llsd_pair.first, llsd_pair.second);
             //LL_INFOS()<<"BaseCapabilitiesCompleteTracker New Caps "<<iter->first<<" "<< iter->second<<LL_ENDL;
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index c87ceddcb19b5d7088f2484919b318cd235970c7..1f39424a3f71a7c8dc8716d7d640e338fa4935d2 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -2886,17 +2886,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 	// These shaders are non-critical and do not fail shader load
 	if (success)
 	{
-		if (gGLManager.mGLVersion >= 4.19f)
-		{
-			gDeferredPostCASProgram.mName = "Contrast Adaptive Sharpen Shader";
-			gDeferredPostCASProgram.mFeatures.hasSrgb = true;
-			gDeferredPostCASProgram.mShaderFiles.clear();
-			gDeferredPostCASProgram.mShaderFiles.push_back(make_pair("alchemy/postNoTCV.glsl", GL_VERTEX_SHADER));
-			gDeferredPostCASProgram.mShaderFiles.push_back(make_pair("alchemy/CASF.glsl", GL_FRAGMENT_SHADER));
-			gDeferredPostCASProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
-			gDeferredPostCASProgram.createShader(NULL, NULL);
-		}
-
 		{
 			gDeferredPostDLSProgram.mName = "DLS Shader";
 			gDeferredPostDLSProgram.mFeatures.hasSrgb = true;
@@ -2907,7 +2896,33 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 			gDeferredPostDLSProgram.createShader(NULL, NULL);
 		}
 
-		if (gGLManager.mGLVersion >= 4.19f)
+		// [RLVa:KB] - @setsphere
+		{
+			gRlvSphereProgram.mName = "RLVa Sphere Post Processing Shader";
+			gRlvSphereProgram.mFeatures.isDeferred = true;
+			gRlvSphereProgram.mShaderFiles.clear();
+			gRlvSphereProgram.mShaderFiles.push_back(make_pair("deferred/rlvV.glsl", GL_VERTEX_SHADER));
+			if (gGLManager.mGLVersion >= 4.5f)
+				gRlvSphereProgram.mShaderFiles.push_back(make_pair("deferred/rlvF.glsl", GL_FRAGMENT_SHADER));
+			else
+				gRlvSphereProgram.mShaderFiles.push_back(make_pair("deferred/rlvFLegacy.glsl", GL_FRAGMENT_SHADER));
+			gRlvSphereProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+			gRlvSphereProgram.createShader(NULL, NULL);
+		}
+		// [/RLV:KB]
+#ifndef LL_DARWIN
+		if (gGLManager.mGLVersion >= 4.59f)
+		{
+			gDeferredPostCASProgram.mName = "Contrast Adaptive Sharpen Shader";
+			gDeferredPostCASProgram.mFeatures.hasSrgb = true;
+			gDeferredPostCASProgram.mShaderFiles.clear();
+			gDeferredPostCASProgram.mShaderFiles.push_back(make_pair("alchemy/postNoTCV.glsl", GL_VERTEX_SHADER));
+			gDeferredPostCASProgram.mShaderFiles.push_back(make_pair("alchemy/CASF.glsl", GL_FRAGMENT_SHADER));
+			gDeferredPostCASProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+			gDeferredPostCASProgram.createShader(NULL, NULL);
+		}
+
+		if (gGLManager.mGLVersion >= 4.59f)
 		{
 			gDeferredPostTonemapLPMProgram.mName = "Tonemapping Shader LPM";
 			gDeferredPostTonemapLPMProgram.mFeatures.hasSrgb = true;
@@ -2920,21 +2935,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 			gDeferredPostTonemapLPMProgram.addPermutation("TONEMAP_METHOD", std::to_string(ALRenderUtil::TONEMAP_AMD));
 			gDeferredPostTonemapLPMProgram.createShader(NULL, NULL); // Ignore return value for this shader
 		}
-// [RLVa:KB] - @setsphere
-		if (success)
-		{
-			gRlvSphereProgram.mName = "RLVa Sphere Post Processing Shader";
-			gRlvSphereProgram.mFeatures.isDeferred = true;
-			gRlvSphereProgram.mShaderFiles.clear();
-			gRlvSphereProgram.mShaderFiles.push_back(make_pair("deferred/rlvV.glsl", GL_VERTEX_SHADER));
- 			if (gGLManager.mGLVersion >= 4.5f)
-				gRlvSphereProgram.mShaderFiles.push_back(make_pair("deferred/rlvF.glsl", GL_FRAGMENT_SHADER));
-			else
-				gRlvSphereProgram.mShaderFiles.push_back(make_pair("deferred/rlvFLegacy.glsl", GL_FRAGMENT_SHADER));
-			gRlvSphereProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
-			gRlvSphereProgram.createShader(NULL, NULL);
-		}
-// [/RLV:KB]
+#endif
 	}
 
 	return success;
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 00b72a4e32a175f95891ee0bf4f915c24dd31d42..bce1fc0c0e8a1cf05725e684823937e91e698f04 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -127,7 +127,7 @@ void LLViewerTextureList::doPreloadImages()
 	LLViewerFetchedTexture::sDefaultIrradiancePBRp = LLViewerTextureManager::getFetchedTextureFromFile("default_irradiance.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
 	
 	// Set the default particle image
-	LLViewerFetchedTexture::sPixieSmallImagep = LLViewerTextureManager::getFetchedTextureFromFile("PixieSmall.png", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
+	LLViewerFetchedTexture::sPixieSmallImagep = LLViewerTextureManager::getFetchedTextureFromFile("pixiesmall.j2c", FTT_LOCAL_FILE, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI);
 
 	image_list->initFromFile();