Index: /binary-improvements/7dtd-server-fixes/src/ChatHookExample.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/ChatHookExample.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/ChatHookExample.cs	(revision 326)
@@ -5,18 +5,17 @@
 
 		public static bool Hook (ClientInfo _cInfo, EChatType _type, string _message, string _playerName) {
-			if (!string.IsNullOrEmpty (_message)) {
-				if (_message.EqualsCaseInsensitive ("/alloc")) {
-					if (_cInfo != null) {
-						Log.Out ("Sent chat hook reply to {0}", _cInfo.playerId);
-						_cInfo.SendPackage (new NetPackageChat (EChatType.Whisper, -1, ANSWER, "", false, null));
-					} else {
-						Log.Error ("ChatHookExample: Argument _cInfo null on message: {0}", _message);
-					}
-
-					return false;
-				}
+			if (string.IsNullOrEmpty (_message) || !_message.EqualsCaseInsensitive ("/alloc")) {
+				return true;
 			}
 
-			return true;
+			if (_cInfo != null) {
+				Log.Out ("Sent chat hook reply to {0}", _cInfo.playerId);
+				_cInfo.SendPackage (new NetPackageChat (EChatType.Whisper, -1, ANSWER, "", false, null));
+			} else {
+				Log.Error ("ChatHookExample: Argument _cInfo null on message: {0}", _message);
+			}
+
+			return false;
+
 		}
 	}
Index: /binary-improvements/7dtd-server-fixes/src/FileCache/MapTileCache.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/FileCache/MapTileCache.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/FileCache/MapTileCache.cs	(revision 326)
@@ -54,8 +54,10 @@
 			try {
 				lock (cache) {
-					if (cache [zoomlevel].filename != null) {
-						cache [zoomlevel].data = content;
-						File.WriteAllBytes (cache [zoomlevel].filename, content);
+					if (cache [zoomlevel].filename == null) {
+						return;
 					}
+
+					cache [zoomlevel].data = content;
+					File.WriteAllBytes (cache [zoomlevel].filename, content);
 				}
 			} catch (Exception e) {
Index: /binary-improvements/7dtd-server-fixes/src/JSON/JSONNull.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/JSON/JSONNull.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/JSON/JSONNull.cs	(revision 326)
@@ -10,11 +10,11 @@
 			//Log.Out ("ParseNull enter (" + offset + ")");
 
-			if (json.Substring (offset, 4).Equals ("null")) {
-				//Log.Out ("JSON:Parsed Null");
-				offset += 4;
-				return new JSONNull ();
+			if (!json.Substring (offset, 4).Equals ("null")) {
+				throw new MalformedJSONException ("No valid null value found");
 			}
 
-			throw new MalformedJSONException ("No valid null value found");
+			//Log.Out ("JSON:Parsed Null");
+			offset += 4;
+			return new JSONNull ();
 		}
 	}
Index: /binary-improvements/7dtd-server-fixes/src/JSON/JSONObject.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/JSON/JSONObject.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/JSON/JSONObject.cs	(revision 326)
@@ -104,4 +104,6 @@
 						//Log.Out ("JSON:Parsed Object: " + obj.ToString ());
 						return obj;
+					default:
+						break;
 				}
 			}
Index: /binary-improvements/7dtd-server-fixes/src/LandClaimList.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/LandClaimList.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/LandClaimList.cs	(revision 326)
@@ -14,48 +14,50 @@
 			Dictionary<Player, List<Vector3i>> result = new Dictionary<Player, List<Vector3i>> ();
 
-			if (d != null) {
-				Dictionary<PersistentPlayerData, List<Vector3i>> owners =
-					new Dictionary<PersistentPlayerData, List<Vector3i>> ();
-				foreach (KeyValuePair<Vector3i, PersistentPlayerData> kvp in d) {
-					bool allowed = true;
-					if (_positionFilters != null) {
-						foreach (PositionFilter pf in _positionFilters) {
-							if (!pf (kvp.Key)) {
-								allowed = false;
-								break;
-							}
+			if (d == null) {
+				return result;
+			}
+
+			Dictionary<PersistentPlayerData, List<Vector3i>> owners =
+				new Dictionary<PersistentPlayerData, List<Vector3i>> ();
+			foreach (KeyValuePair<Vector3i, PersistentPlayerData> kvp in d) {
+				bool allowed = true;
+				if (_positionFilters != null) {
+					foreach (PositionFilter pf in _positionFilters) {
+						if (!pf (kvp.Key)) {
+							allowed = false;
+							break;
 						}
-					}
-
-					if (allowed) {
-						if (!owners.ContainsKey (kvp.Value)) {
-							owners.Add (kvp.Value, new List<Vector3i> ());
-						}
-
-						owners [kvp.Value].Add (kvp.Key);
 					}
 				}
 
-				foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) {
-					Player p = PersistentContainer.Instance.Players [kvp.Key.PlayerId, false];
-					if (p == null) {
-						p = new Player (kvp.Key.PlayerId);
+				if (allowed) {
+					if (!owners.ContainsKey (kvp.Value)) {
+						owners.Add (kvp.Value, new List<Vector3i> ());
 					}
 
-					bool allowed = true;
-					if (_ownerFilters != null) {
-						foreach (OwnerFilter of in _ownerFilters) {
-							if (!of (p)) {
-								allowed = false;
-								break;
-							}
+					owners [kvp.Value].Add (kvp.Key);
+				}
+			}
+
+			foreach (KeyValuePair<PersistentPlayerData, List<Vector3i>> kvp in owners) {
+				Player p = PersistentContainer.Instance.Players [kvp.Key.PlayerId, false];
+				if (p == null) {
+					p = new Player (kvp.Key.PlayerId);
+				}
+
+				bool allowed = true;
+				if (_ownerFilters != null) {
+					foreach (OwnerFilter of in _ownerFilters) {
+						if (!of (p)) {
+							allowed = false;
+							break;
 						}
 					}
+				}
 
-					if (allowed) {
-						result.Add (p, new List<Vector3i> ());
-						foreach (Vector3i v in kvp.Value) {
-							result [p].Add (v);
-						}
+				if (allowed) {
+					result.Add (p, new List<Vector3i> ());
+					foreach (Vector3i v in kvp.Value) {
+						result [p].Add (v);
 					}
 				}
Index: /binary-improvements/7dtd-server-fixes/src/LiveData/Animals.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/LiveData/Animals.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/LiveData/Animals.cs	(revision 326)
@@ -4,10 +4,7 @@
 
 		protected override EntityAnimal predicate (Entity _e) {
-			if (_e is EntityAnimal) {
-				EntityAnimal ea = (EntityAnimal) _e;
-
-				if (ea.IsAlive ()) {
-					return ea;
-				}
+			EntityAnimal ea = _e as EntityAnimal;
+			if (ea != null && ea.IsAlive ()) {
+				return ea;
 			}
 
Index: /binary-improvements/7dtd-server-fixes/src/LiveData/Hostiles.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/LiveData/Hostiles.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/LiveData/Hostiles.cs	(revision 326)
@@ -4,8 +4,7 @@
 
 		protected override EntityEnemy predicate (Entity _e) {
-			if (_e is EntityEnemy) {
-				if (_e.IsAlive ()) {
-					return _e as EntityEnemy;
-				}
+			EntityEnemy enemy = _e as EntityEnemy;
+			if (enemy != null && enemy.IsAlive ()) {
+				return enemy;
 			}
 
Index: /binary-improvements/7dtd-server-fixes/src/PersistentData/Attributes.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/PersistentData/Attributes.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/PersistentData/Attributes.cs	(revision 326)
@@ -5,5 +5,5 @@
 	public class Attributes {
 		private bool hideChatCommands;
-		private String hideChatCommandPrefix;
+		private string hideChatCommandPrefix;
 
 		public bool HideChatCommands {
Index: /binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/PersistentData/Inventory.cs	(revision 326)
@@ -58,29 +58,29 @@
 
 		private InvItem CreateInvItem (ItemValue _itemValue, int _count, int _playerId) {
-			if (_count > 0 && _itemValue != null && !_itemValue.Equals (ItemValue.None)) {
-				ItemClass itemClass = ItemClass.list [_itemValue.type];
-				int maxAllowed = itemClass.Stacknumber.Value;
-				string name = itemClass.GetItemName ();
-
-				if (_count > maxAllowed) {
-					Log.Out ("Player with ID " + _playerId + " has stack for \"" + name + "\" greater than allowed (" +
-					         _count + " > " + maxAllowed + ")");
-				}
-
-				InvItem item = null;
-				if (_itemValue.HasQuality) {
-					item = new InvItem (name, _count, _itemValue.Quality, _itemValue.MaxUseTimes, _itemValue.UseTimes);
-				} else {
-					item = new InvItem (name, _count, -1, _itemValue.MaxUseTimes, _itemValue.UseTimes);
-				}
-
-				item.icon = itemClass.GetIconName ();
-
-				item.iconcolor = AllocsUtils.ColorToHex (itemClass.GetIconTint ());
-
-				return item;
+			if (_count <= 0 || _itemValue == null || _itemValue.Equals (ItemValue.None)) {
+				return null;
 			}
 
-			return null;
+			ItemClass itemClass = ItemClass.list [_itemValue.type];
+			int maxAllowed = itemClass.Stacknumber.Value;
+			string name = itemClass.GetItemName ();
+
+			if (_count > maxAllowed) {
+				Log.Out ("Player with ID " + _playerId + " has stack for \"" + name + "\" greater than allowed (" +
+				         _count + " > " + maxAllowed + ")");
+			}
+
+			InvItem item;
+			if (_itemValue.HasQuality) {
+				item = new InvItem (name, _count, _itemValue.Quality, _itemValue.MaxUseTimes, _itemValue.UseTimes);
+			} else {
+				item = new InvItem (name, _count, -1, _itemValue.MaxUseTimes, _itemValue.UseTimes);
+			}
+
+			item.icon = itemClass.GetIconName ();
+
+			item.iconcolor = AllocsUtils.ColorToHex (itemClass.GetIconTint ());
+
+			return item;
 		}
 	}
Index: /binary-improvements/7dtd-server-fixes/src/PersistentData/PersistentContainer.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/PersistentData/PersistentContainer.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/PersistentData/PersistentContainer.cs	(revision 326)
@@ -53,17 +53,19 @@
 
 		public static bool Load () {
-			if (File.Exists (GameUtils.GetSaveGameDir () + "/AllocsPeristentData.bin")) {
-				try {
-					PersistentContainer obj;
-					Stream stream = File.Open (GameUtils.GetSaveGameDir () + "/AllocsPeristentData.bin", FileMode.Open);
-					BinaryFormatter bFormatter = new BinaryFormatter ();
-					obj = (PersistentContainer) bFormatter.Deserialize (stream);
-					stream.Close ();
-					instance = obj;
-					return true;
-				} catch (Exception e) {
-					Log.Error ("Exception in PersistentContainer.Load");
-					Log.Exception (e);
-				}
+			if (!File.Exists (GameUtils.GetSaveGameDir () + "/AllocsPeristentData.bin")) {
+				return false;
+			}
+
+			try {
+				PersistentContainer obj;
+				Stream stream = File.Open (GameUtils.GetSaveGameDir () + "/AllocsPeristentData.bin", FileMode.Open);
+				BinaryFormatter bFormatter = new BinaryFormatter ();
+				obj = (PersistentContainer) bFormatter.Deserialize (stream);
+				stream.Close ();
+				instance = obj;
+				return true;
+			} catch (Exception e) {
+				Log.Error ("Exception in PersistentContainer.Load");
+				Log.Exception (e);
 			}
 
Index: /binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/PersistentData/Player.cs	(revision 326)
@@ -174,19 +174,21 @@
 
 		public void SetOffline () {
-			if (clientInfo != null) {
-				Log.Out ("Player set to offline: " + steamId);
-				lastOnline = DateTime.Now;
-				try {
-					Vector3i lastPos = new Vector3i (Entity.GetPosition ());
-					lastPositionX = lastPos.x;
-					lastPositionY = lastPos.y;
-					lastPositionZ = lastPos.z;
-					totalPlayTime += (long) (Time.timeSinceLevelLoad - Entity.CreationTimeSinceLevelLoad);
-				} catch (NullReferenceException) {
-					Log.Out ("Entity not available. Something seems to be wrong here...");
-				}
-
-				clientInfo = null;
-			}
+			if (clientInfo == null) {
+				return;
+			}
+
+			Log.Out ("Player set to offline: " + steamId);
+			lastOnline = DateTime.Now;
+			try {
+				Vector3i lastPos = new Vector3i (Entity.GetPosition ());
+				lastPositionX = lastPos.x;
+				lastPositionY = lastPos.y;
+				lastPositionZ = lastPos.z;
+				totalPlayTime += (long) (Time.timeSinceLevelLoad - Entity.CreationTimeSinceLevelLoad);
+			} catch (NullReferenceException) {
+				Log.Out ("Entity not available. Something seems to be wrong here...");
+			}
+
+			clientInfo = null;
 		}
 
@@ -206,11 +208,13 @@
 
 		private void UpdateProgression (PlayerDataFile _pdf) {
-			if (_pdf.progressionData.Length > 0) {
-				using (PooledBinaryReader pbr = MemoryPools.poolBinaryReader.AllocSync (false)) {
-					pbr.SetBaseStream (_pdf.progressionData);
-					Progression p = Progression.Read (pbr, null);
-					expToNextLevel = (uint) p.ExpToNextLevel;
-					level = p.Level;
-				}
+			if (_pdf.progressionData.Length <= 0) {
+				return;
+			}
+
+			using (PooledBinaryReader pbr = MemoryPools.poolBinaryReader.AllocSync (false)) {
+				pbr.SetBaseStream (_pdf.progressionData);
+				Progression p = Progression.Read (pbr, null);
+				expToNextLevel = (uint) p.ExpToNextLevel;
+				level = p.Level;
 			}
 		}
Index: /binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs
===================================================================
--- /binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs	(revision 325)
+++ /binary-improvements/7dtd-server-fixes/src/PersistentData/Players.cs	(revision 326)
@@ -6,5 +6,5 @@
 	[Serializable]
 	public class Players {
-		private readonly Dictionary<string, Player> players = new Dictionary<string, Player> ();
+		private readonly Dictionary<string, Player> players = new CaseInsensitiveStringDictionary<Player> ();
 
 		public Player this [string steamId, bool create] {
@@ -18,12 +18,12 @@
 				}
 
-				if (create && steamId != null && steamId.Length == 17) {
-					Log.Out ("Created new player entry for ID: " + steamId);
-					Player p = new Player (steamId);
-					players.Add (steamId, p);
-					return p;
+				if (!create || steamId.Length != 17) {
+					return null;
 				}
 
-				return null;
+				Log.Out ("Created new player entry for ID: " + steamId);
+				Player p = new Player (steamId);
+				players.Add (steamId, p);
+				return p;
 			}
 		}
@@ -56,5 +56,5 @@
 			}
 
-			int entityId = -1;
+			int entityId;
 			if (int.TryParse (_nameOrId, out entityId)) {
 				foreach (KeyValuePair<string, Player> kvp in players) {
@@ -65,12 +65,11 @@
 			}
 
-			_nameOrId = _nameOrId.ToLower ();
 			foreach (KeyValuePair<string, Player> kvp in players) {
-				string name = kvp.Value.Name.ToLower ();
+				string name = kvp.Value.Name;
 				if (_ignoreColorCodes) {
 					name = Regex.Replace (name, "\\[[0-9a-fA-F]{6}\\]", "");
 				}
 
-				if (kvp.Value.IsOnline && name.Equals (_nameOrId)) {
+				if (kvp.Value.IsOnline && name.EqualsCaseInsensitive (_nameOrId)) {
 					return kvp.Key;
 				}
Index: /binary-improvements/AllocsCommands/Commands/Give.cs
===================================================================
--- /binary-improvements/AllocsCommands/Commands/Give.cs	(revision 325)
+++ /binary-improvements/AllocsCommands/Commands/Give.cs	(revision 326)
@@ -47,5 +47,5 @@
 				iv = new ItemValue (iv.type, true);
 
-				int n = int.MinValue;
+				int n;
 				if (!int.TryParse (_params [2], out n) || n <= 0) {
 					SdtdConsole.Instance.Output ("Amount is not an integer or not greater than zero.");
Index: /binary-improvements/AllocsCommands/Commands/ListKnownPlayers.cs
===================================================================
--- /binary-improvements/AllocsCommands/Commands/ListKnownPlayers.cs	(revision 325)
+++ /binary-improvements/AllocsCommands/Commands/ListKnownPlayers.cs	(revision 326)
@@ -35,13 +35,13 @@
 
 				if (_params.Count == 1) {
-					long steamid = -1;
-					if (_params [0].ToLower ().Equals ("-online")) {
+					long steamid;
+					if (_params [0].EqualsCaseInsensitive ("-online")) {
 						onlineOnly = true;
-					} else if (_params [0].ToLower ().Equals ("-notbanned")) {
+					} else if (_params [0].EqualsCaseInsensitive ("-notbanned")) {
 						notBannedOnly = true;
 					} else if (_params [0].Length == 17 && long.TryParse (_params [0], out steamid)) {
 						isSteamId = true;
 					} else {
-						nameFilter = _params [0].ToLower ();
+						nameFilter = _params [0];
 					}
 				}
@@ -53,10 +53,10 @@
 						SdtdConsole.Instance.Output (string.Format (
 							"{0}. {1}, id={2}, steamid={3}, online={4}, ip={5}, playtime={6} m, seen={7}",
-							0, p.Name, p.EntityID, nameFilter, p.IsOnline, p.IP,
+							0, p.Name, p.EntityID, _params [0], p.IsOnline, p.IP,
 							p.TotalPlayTime / 60,
 							p.LastOnline.ToString ("yyyy-MM-dd HH:mm"))
 						);
 					} else {
-						SdtdConsole.Instance.Output (string.Format ("SteamID {0} unknown!", nameFilter));
+						SdtdConsole.Instance.Output (string.Format ("SteamID {0} unknown!", _params [0]));
 					}
 				} else {
@@ -68,5 +68,5 @@
 							(!onlineOnly || p.IsOnline)
 							&& (!notBannedOnly || !admTools.IsBanned (sid))
-							&& (nameFilter.Length == 0 || p.Name.ToLower ().Contains (nameFilter))
+							&& (nameFilter.Length == 0 || p.Name.ContainsCaseInsensitive (nameFilter))
 						) {
 							SdtdConsole.Instance.Output (string.Format (
Index: /binary-improvements/AllocsCommands/Commands/ListLandProtection.cs
===================================================================
--- /binary-improvements/AllocsCommands/Commands/ListLandProtection.cs	(revision 325)
+++ /binary-improvements/AllocsCommands/Commands/ListLandProtection.cs	(revision 326)
@@ -27,5 +27,5 @@
 			try {
 				if (_senderInfo.RemoteClientInfo != null) {
-					if (_params.Count >= 1 && _params [0].ToLower ().Equals ("nearby")) {
+					if (_params.Count >= 1 && _params [0].EqualsCaseInsensitive ("nearby")) {
 						_params.Add (_senderInfo.RemoteClientInfo.playerId);
 					}
@@ -50,5 +50,5 @@
 					long tempLong;
 
-					if (_params [0].ToLower ().Equals ("summary")) {
+					if (_params [0].EqualsCaseInsensitive ("summary")) {
 						summaryOnly = true;
 					} else if (_params [0].Length == 17 && long.TryParse (_params [0], out tempLong)) {
@@ -64,5 +64,5 @@
 					}
 				} else if (_params.Count >= 2) {
-					if (_params [0].ToLower ().Equals ("nearby")) {
+					if (_params [0].EqualsCaseInsensitive ("nearby")) {
 						try {
 							if (_params.Count == 3) {
@@ -123,5 +123,5 @@
 				}
 
-				if (steamIdFilter.Length == 0) {
+				if (string.IsNullOrEmpty (steamIdFilter)) {
 					SdtdConsole.Instance.Output ("Total of " + ppl.m_lpBlockMap.Count + " keystones in the game");
 				}
Index: /binary-improvements/AllocsCommands/Commands/RemoveLandProtection.cs
===================================================================
--- /binary-improvements/AllocsCommands/Commands/RemoveLandProtection.cs	(revision 325)
+++ /binary-improvements/AllocsCommands/Commands/RemoveLandProtection.cs	(revision 326)
@@ -59,9 +59,7 @@
 		private void removeByPosition (List<string> _coords) {
 			try {
-				int x = int.MinValue;
+				int x, y, z;
 				int.TryParse (_coords [0], out x);
-				int y = int.MinValue;
 				int.TryParse (_coords [1], out y);
-				int z = int.MinValue;
 				int.TryParse (_coords [2], out z);
 
Index: /binary-improvements/AllocsCommands/PrivateMessageConnections.cs
===================================================================
--- /binary-improvements/AllocsCommands/PrivateMessageConnections.cs	(revision 325)
+++ /binary-improvements/AllocsCommands/PrivateMessageConnections.cs	(revision 326)
@@ -11,11 +11,11 @@
 
 		public static ClientInfo GetLastPMSenderForPlayer (ClientInfo _player) {
-			if (senderOfLastPM.ContainsKey (_player.steamId)) {
-				CSteamID recSteamId = senderOfLastPM [_player.steamId];
-				ClientInfo recInfo = ConnectionManager.Instance.Clients.ForSteamId (recSteamId);
-				return recInfo;
+			if (!senderOfLastPM.ContainsKey (_player.steamId)) {
+				return null;
 			}
 
-			return null;
+			CSteamID recSteamId = senderOfLastPM [_player.steamId];
+			ClientInfo recInfo = ConnectionManager.Instance.Clients.ForSteamId (recSteamId);
+			return recInfo;
 		}
 	}
Index: /binary-improvements/MapRendering/API.cs
===================================================================
--- /binary-improvements/MapRendering/API.cs	(revision 325)
+++ /binary-improvements/MapRendering/API.cs	(revision 326)
@@ -14,5 +14,5 @@
 			// ReSharper disable once ObjectCreationAsStatement
 			new Web ();
-			LogBuffer.Instance.GetType ();
+			LogBuffer.Init ();
 		}
 
Index: /binary-improvements/MapRendering/Commands/WebPermissionsCmd.cs
===================================================================
--- /binary-improvements/MapRendering/Commands/WebPermissionsCmd.cs	(revision 325)
+++ /binary-improvements/MapRendering/Commands/WebPermissionsCmd.cs	(revision 326)
@@ -23,17 +23,12 @@
 		public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) {
 			if (_params.Count >= 1) {
-				switch (_params [0].ToLower ()) {
-					case "add":
-						ExecuteAdd (_params);
-						break;
-					case "remove":
-						ExecuteRemove (_params);
-						break;
-					case "list":
-						ExecuteList ();
-						break;
-					default:
-						SdtdConsole.Instance.Output ("Invalid sub command \"" + _params [0] + "\".");
-						return;
+				if (_params [0].EqualsCaseInsensitive ("add")) {
+					ExecuteAdd (_params);
+				} else if (_params [0].EqualsCaseInsensitive ("remove")) {
+					ExecuteRemove (_params);
+				} else if (_params [0].EqualsCaseInsensitive ("list")) {
+					ExecuteList ();
+				} else {
+					SdtdConsole.Instance.Output ("Invalid sub command \"" + _params [0] + "\".");
 				}
 			} else {
Index: /binary-improvements/MapRendering/Commands/WebTokens.cs
===================================================================
--- /binary-improvements/MapRendering/Commands/WebTokens.cs	(revision 325)
+++ /binary-improvements/MapRendering/Commands/WebTokens.cs	(revision 326)
@@ -25,17 +25,12 @@
 		public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) {
 			if (_params.Count >= 1) {
-				switch (_params [0].ToLower ()) {
-					case "add":
-						ExecuteAdd (_params);
-						break;
-					case "remove":
-						ExecuteRemove (_params);
-						break;
-					case "list":
-						ExecuteList ();
-						break;
-					default:
-						SdtdConsole.Instance.Output ("Invalid sub command \"" + _params [0] + "\".");
-						return;
+				if (_params [0].EqualsCaseInsensitive ("add")) {
+					ExecuteAdd (_params);
+				} else if (_params [0].EqualsCaseInsensitive ("remove")) {
+					ExecuteRemove (_params);
+				} else if (_params [0].EqualsCaseInsensitive ("list")) {
+					ExecuteList ();
+				} else {
+					SdtdConsole.Instance.Output ("Invalid sub command \"" + _params [0] + "\".");
 				}
 			} else {
Index: /binary-improvements/MapRendering/MapRendering/MapRenderBlockBuffer.cs
===================================================================
--- /binary-improvements/MapRendering/MapRendering/MapRenderBlockBuffer.cs	(revision 325)
+++ /binary-improvements/MapRendering/MapRendering/MapRenderBlockBuffer.cs	(revision 326)
@@ -71,18 +71,20 @@
 		private void loadTextureFromFile (string _fileName) {
 			byte[] array = cache.LoadTile (zoomLevel, _fileName);
-			if (array == null || !blockMap.LoadImage (array) || blockMap.height != Constants.MAP_BLOCK_SIZE ||
-			    blockMap.width != Constants.MAP_BLOCK_SIZE) {
-				if (array != null) {
-					Log.Error ("Map image tile " + _fileName + " has been corrupted, recreating tile");
-				}
+			if (array != null && blockMap.LoadImage (array) && blockMap.height == Constants.MAP_BLOCK_SIZE &&
+			    blockMap.width == Constants.MAP_BLOCK_SIZE) {
+				return;
+			}
 
-				if (blockMap.height != Constants.MAP_BLOCK_SIZE || blockMap.width != Constants.MAP_BLOCK_SIZE) {
-					blockMap.Resize (Constants.MAP_BLOCK_SIZE, Constants.MAP_BLOCK_SIZE);
-				}
+			if (array != null) {
+				Log.Error ("Map image tile " + _fileName + " has been corrupted, recreating tile");
+			}
 
-				for (int x = 0; x < Constants.MAP_BLOCK_SIZE; x++) {
-					for (int y = 0; y < Constants.MAP_BLOCK_SIZE; y++) {
-						blockMap.SetPixel (x, y, nullColor);
-					}
+			if (blockMap.height != Constants.MAP_BLOCK_SIZE || blockMap.width != Constants.MAP_BLOCK_SIZE) {
+				blockMap.Resize (Constants.MAP_BLOCK_SIZE, Constants.MAP_BLOCK_SIZE);
+			}
+
+			for (int x = 0; x < Constants.MAP_BLOCK_SIZE; x++) {
+				for (int y = 0; y < Constants.MAP_BLOCK_SIZE; y++) {
+					blockMap.SetPixel (x, y, nullColor);
 				}
 			}
Index: /binary-improvements/MapRendering/MapRendering/MapRendering.cs
===================================================================
--- /binary-improvements/MapRendering/MapRendering/MapRendering.cs	(revision 325)
+++ /binary-improvements/MapRendering/MapRendering/MapRendering.cs	(revision 326)
@@ -104,6 +104,6 @@
 			Texture2D fullMapTexture = null;
 
-			Vector2i minChunk = default (Vector2i), maxChunk = default (Vector2i);
-			Vector2i minPos = default (Vector2i), maxPos = default (Vector2i);
+			Vector2i minChunk, maxChunk;
+			Vector2i minPos, maxPos;
 			int widthChunks, heightChunks, widthPix, heightPix;
 			getWorldExtent (rfm, out minChunk, out maxChunk, out minPos, out maxPos, out widthChunks, out heightChunks,
@@ -181,5 +181,4 @@
 				File.WriteAllBytes (Constants.MAP_DIRECTORY + "/map.png", array);
 				Object.Destroy (fullMapTexture);
-				fullMapTexture = null;
 			}
 
@@ -190,5 +189,5 @@
 		}
 
-		private void SaveAllBlockMaps (object source, ElapsedEventArgs e) {
+		private void SaveAllBlockMaps () {
 			for (int i = 0; i < Constants.ZOOMLEVELS; i++) {
 				zoomLevelBuffers [i].SaveBlock ();
@@ -215,56 +214,59 @@
 			msw.ResetAndRestart ();
 
-			if (dirtyChunks.Count > 0) {
-				List<Vector2i> keys = new List<Vector2i> (dirtyChunks.Keys);
-				List<Vector2i> chunksDone = new List<Vector2i> ();
-
-				Vector2i chunkPos = keys [0];
-				chunksDone.Add (chunkPos);
-
-				//Log.Out ("Start Dirty: " + chunkPos);
-
-				Vector2i block = default (Vector2i), blockOffset = default (Vector2i);
-				getBlockNumber (chunkPos, out block, out blockOffset, Constants.MAP_BLOCK_TO_CHUNK_DIV,
+			if (dirtyChunks.Count <= 0) {
+				return;
+			}
+
+			List<Vector2i> keys = new List<Vector2i> (dirtyChunks.Keys);
+			List<Vector2i> chunksDone = new List<Vector2i> ();
+
+			Vector2i chunkPos = keys [0];
+			chunksDone.Add (chunkPos);
+
+			//Log.Out ("Start Dirty: " + chunkPos);
+
+			Vector2i block, blockOffset;
+			getBlockNumber (chunkPos, out block, out blockOffset, Constants.MAP_BLOCK_TO_CHUNK_DIV,
+				Constants.MAP_CHUNK_SIZE);
+
+			zoomLevelBuffers [Constants.ZOOMLEVELS - 1].LoadBlock (block);
+
+			Vector2i v_block, v_blockOffset;
+			foreach (Vector2i v in keys) {
+				getBlockNumber (v, out v_block, out v_blockOffset, Constants.MAP_BLOCK_TO_CHUNK_DIV,
 					Constants.MAP_CHUNK_SIZE);
-
-				zoomLevelBuffers [Constants.ZOOMLEVELS - 1].LoadBlock (block);
-
-				Vector2i v_block = default (Vector2i), v_blockOffset = default (Vector2i);
-				foreach (Vector2i v in keys) {
-					getBlockNumber (v, out v_block, out v_blockOffset, Constants.MAP_BLOCK_TO_CHUNK_DIV,
-						Constants.MAP_CHUNK_SIZE);
-					if (v_block.Equals (block)) {
-						//Log.Out ("Dirty: " + v + " render: true");
-						chunksDone.Add (v);
-						if (dirtyChunks [v].Length != Constants.MAP_CHUNK_SIZE * Constants.MAP_CHUNK_SIZE) {
-							Log.Error (string.Format ("Rendering chunk has incorrect data size of {0} instead of {1}",
-								dirtyChunks [v].Length, Constants.MAP_CHUNK_SIZE * Constants.MAP_CHUNK_SIZE));
-						}
-
-						zoomLevelBuffers [Constants.ZOOMLEVELS - 1]
-							.SetPart (v_blockOffset, Constants.MAP_CHUNK_SIZE, dirtyChunks [v]);
-					}
-				}
-
-				foreach (Vector2i v in chunksDone) {
-					dirtyChunks.Remove (v);
-				}
-
-				RenderZoomLevel (Constants.ZOOMLEVELS - 1, block);
-
-				SaveAllBlockMaps (null, null);
-			}
-		}
-
-		private void RenderZoomLevel (int level, Vector2i innerBlock) {
-			if (level > 0) {
-				Vector2i block = default (Vector2i), blockOffset = default (Vector2i);
+				if (v_block.Equals (block)) {
+					//Log.Out ("Dirty: " + v + " render: true");
+					chunksDone.Add (v);
+					if (dirtyChunks [v].Length != Constants.MAP_CHUNK_SIZE * Constants.MAP_CHUNK_SIZE) {
+						Log.Error (string.Format ("Rendering chunk has incorrect data size of {0} instead of {1}",
+							dirtyChunks [v].Length, Constants.MAP_CHUNK_SIZE * Constants.MAP_CHUNK_SIZE));
+					}
+
+					zoomLevelBuffers [Constants.ZOOMLEVELS - 1]
+						.SetPart (v_blockOffset, Constants.MAP_CHUNK_SIZE, dirtyChunks [v]);
+				}
+			}
+
+			foreach (Vector2i v in chunksDone) {
+				dirtyChunks.Remove (v);
+			}
+
+			RenderZoomLevel (block);
+
+			SaveAllBlockMaps ();
+		}
+
+		private void RenderZoomLevel (Vector2i innerBlock) {
+			int level = Constants.ZOOMLEVELS - 1;
+			while (level > 0) {
+				Vector2i block, blockOffset;
 				getBlockNumber (innerBlock, out block, out blockOffset, 2, Constants.MAP_BLOCK_SIZE / 2);
 
 				zoomLevelBuffers [level - 1].LoadBlock (block);
-				zoomLevelBuffers [level - 1].SetPart (blockOffset, Constants.MAP_BLOCK_SIZE / 2,
-					zoomLevelBuffers [level].GetHalfScaled ());
-
-				RenderZoomLevel (level - 1, block);
+				zoomLevelBuffers [level - 1].SetPart (blockOffset, Constants.MAP_BLOCK_SIZE / 2, zoomLevelBuffers [level].GetHalfScaled ());
+
+				level = level - 1;
+				innerBlock = block;
 			}
 		}
@@ -290,25 +292,27 @@
 
 		private bool LoadMapInfo () {
-			if (File.Exists (Constants.MAP_DIRECTORY + "/mapinfo.json")) {
-				string json = File.ReadAllText (Constants.MAP_DIRECTORY + "/mapinfo.json", Encoding.UTF8);
-				try {
-					JSONNode node = Parser.Parse (json);
-					if (node is JSONObject) {
-						JSONObject jo = (JSONObject) node;
-						if (jo.ContainsKey ("blockSize")) {
-							Constants.MAP_BLOCK_SIZE = ((JSONNumber) jo ["blockSize"]).GetInt ();
-						}
-
-						if (jo.ContainsKey ("maxZoom")) {
-							Constants.ZOOMLEVELS = ((JSONNumber) jo ["maxZoom"]).GetInt () + 1;
-						}
-
-						return true;
-					}
-				} catch (MalformedJSONException e) {
-					Log.Out ("Exception in LoadMapInfo: " + e);
-				} catch (InvalidCastException e) {
-					Log.Out ("Exception in LoadMapInfo: " + e);
-				}
+			if (!File.Exists (Constants.MAP_DIRECTORY + "/mapinfo.json")) {
+				return false;
+			}
+
+			string json = File.ReadAllText (Constants.MAP_DIRECTORY + "/mapinfo.json", Encoding.UTF8);
+			try {
+				JSONNode node = Parser.Parse (json);
+				if (node is JSONObject) {
+					JSONObject jo = (JSONObject) node;
+					if (jo.ContainsKey ("blockSize")) {
+						Constants.MAP_BLOCK_SIZE = ((JSONNumber) jo ["blockSize"]).GetInt ();
+					}
+
+					if (jo.ContainsKey ("maxZoom")) {
+						Constants.ZOOMLEVELS = ((JSONNumber) jo ["maxZoom"]).GetInt () + 1;
+					}
+
+					return true;
+				}
+			} catch (MalformedJSONException e) {
+				Log.Out ("Exception in LoadMapInfo: " + e);
+			} catch (InvalidCastException e) {
+				Log.Out ("Exception in LoadMapInfo: " + e);
 			}
 
Index: /binary-improvements/MapRendering/Web/API/GetLandClaims.cs
===================================================================
--- /binary-improvements/MapRendering/Web/API/GetLandClaims.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/API/GetLandClaims.cs	(revision 326)
@@ -50,5 +50,5 @@
 
 			foreach (KeyValuePair<Player, List<Vector3i>> kvp in claims) {
-				try {
+//				try {
 					JSONObject owner = new JSONObject ();
 					claimOwners.Add (owner);
@@ -74,6 +74,6 @@
 						claimsJson.Add (claim);
 					}
-				} catch {
-				}
+//				} catch {
+//				}
 			}
 
Index: /binary-improvements/MapRendering/Web/API/GetPlayerInventory.cs
===================================================================
--- /binary-improvements/MapRendering/Web/API/GetPlayerInventory.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/API/GetPlayerInventory.cs	(revision 326)
@@ -75,19 +75,20 @@
 
 		internal static JSONNode GetJsonForItem (InvItem _item) {
-			if (_item != null) {
-				JSONObject jsonItem = new JSONObject ();
-				jsonItem.Add ("count", new JSONNumber (_item.count));
-				jsonItem.Add ("name", new JSONString (_item.itemName));
-				jsonItem.Add ("icon", new JSONString (_item.icon));
-				jsonItem.Add ("iconcolor", new JSONString (_item.iconcolor));
-				jsonItem.Add ("quality", new JSONNumber (_item.quality));
-				if (_item.quality >= 0) {
-					jsonItem.Add ("qualitycolor", new JSONString (QualityInfo.GetQualityColorHex (_item.quality)));
-				}
-
-				return jsonItem;
+			if (_item == null) {
+				return new JSONNull ();
 			}
 
-			return new JSONNull ();
+			JSONObject jsonItem = new JSONObject ();
+			jsonItem.Add ("count", new JSONNumber (_item.count));
+			jsonItem.Add ("name", new JSONString (_item.itemName));
+			jsonItem.Add ("icon", new JSONString (_item.icon));
+			jsonItem.Add ("iconcolor", new JSONString (_item.iconcolor));
+			jsonItem.Add ("quality", new JSONNumber (_item.quality));
+			if (_item.quality >= 0) {
+				jsonItem.Add ("qualitycolor", new JSONString (QualityInfo.GetQualityColorHex (_item.quality)));
+			}
+
+			return jsonItem;
+
 		}
 	}
Index: /binary-improvements/MapRendering/Web/API/GetPlayerList.cs
===================================================================
--- /binary-improvements/MapRendering/Web/API/GetPlayerList.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/API/GetPlayerList.cs	(revision 326)
@@ -40,5 +40,5 @@
 				Player p = playersList [sid, false];
 
-				ulong player_steam_ID = 0L;
+				ulong player_steam_ID;
 				if (!ulong.TryParse (sid, out player_steam_ID)) {
 					player_steam_ID = 0L;
@@ -64,5 +64,5 @@
 					pJson.Add ("ping", new JSONNumber (p.IsOnline ? p.ClientInfo.ping : -1));
 
-					JSONBoolean banned = null;
+					JSONBoolean banned;
 					if (admTools != null) {
 						banned = new JSONBoolean (admTools.IsBanned (sid));
@@ -132,6 +132,6 @@
 
 				if (colType == typeof (JSONBoolean)) {
-					bool value = _filterVal.Trim ().ToLower () == "true";
-					return _list.Where (line => (line [_filterCol] as JSONBoolean).GetBool () == value);
+					bool value = StringParsers.ParseBool (_filterVal);
+					return _list.Where (line => ((JSONBoolean) line [_filterCol]).GetBool () == value);
 				}
 
@@ -143,5 +143,5 @@
 					//Log.Out ("GetPlayerList: Filter on String with Regex '" + _filterVal + "'");
 					Regex matcher = new Regex (_filterVal, RegexOptions.IgnoreCase);
-					return _list.Where (line => matcher.IsMatch ((line [_filterCol] as JSONString).GetString ()));
+					return _list.Where (line => matcher.IsMatch (((JSONString) line [_filterCol]).GetString ()));
 				}
 			}
@@ -185,5 +185,5 @@
 
 				return _list.Where (delegate (JSONObject line) {
-					double objVal = (line [_filterCol] as JSONNumber).GetDouble ();
+					double objVal = ((JSONNumber) line [_filterCol]).GetDouble ();
 					switch (matchType) {
 						case NumberMatchType.Greater:
@@ -216,16 +216,16 @@
 				if (colType == typeof (JSONNumber)) {
 					if (_ascending) {
-						return _list.OrderBy (line => (line [_sortCol] as JSONNumber).GetDouble ());
-					}
-
-					return _list.OrderByDescending (line => (line [_sortCol] as JSONNumber).GetDouble ());
+						return _list.OrderBy (line => ((JSONNumber) line [_sortCol]).GetDouble ());
+					}
+
+					return _list.OrderByDescending (line => ((JSONNumber) line [_sortCol]).GetDouble ());
 				}
 
 				if (colType == typeof (JSONBoolean)) {
 					if (_ascending) {
-						return _list.OrderBy (line => (line [_sortCol] as JSONBoolean).GetBool ());
-					}
-
-					return _list.OrderByDescending (line => (line [_sortCol] as JSONBoolean).GetBool ());
+						return _list.OrderBy (line => ((JSONBoolean) line [_sortCol]).GetBool ());
+					}
+
+					return _list.OrderByDescending (line => ((JSONBoolean) line [_sortCol]).GetBool ());
 				}
 
Index: /binary-improvements/MapRendering/Web/API/GetPlayersLocation.cs
===================================================================
--- /binary-improvements/MapRendering/Web/API/GetPlayersLocation.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/API/GetPlayersLocation.cs	(revision 326)
@@ -31,5 +31,5 @@
 
 				if (listOffline || p.IsOnline) {
-					ulong player_steam_ID = 0L;
+					ulong player_steam_ID;
 					if (!ulong.TryParse (sid, out player_steam_ID)) {
 						player_steam_ID = 0L;
Index: /binary-improvements/MapRendering/Web/API/GetPlayersOnline.cs
===================================================================
--- /binary-improvements/MapRendering/Web/API/GetPlayersOnline.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/API/GetPlayersOnline.cs	(revision 326)
@@ -41,5 +41,5 @@
 				p.Add ("totalplaytime", new JSONNumber (player != null ? player.TotalPlayTime : -1));
 				p.Add ("lastonline", new JSONString (player != null ? player.LastOnline.ToString ("s") : string.Empty));
-				p.Add ("ping", new JSONNumber (ci != null ? ci.ping : -1));
+				p.Add ("ping", new JSONNumber (ci.ping));
 
 				players.Add (p);
Index: /binary-improvements/MapRendering/Web/API/WebAPI.cs
===================================================================
--- /binary-improvements/MapRendering/Web/API/WebAPI.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/API/WebAPI.cs	(revision 326)
@@ -5,4 +5,10 @@
 namespace AllocsFixes.NetConnections.Servers.Web.API {
 	public abstract class WebAPI {
+		public readonly string Name;
+
+		protected WebAPI () {
+			Name = GetType ().Name;
+		}
+
 		public static void WriteJSON (HttpListenerResponse resp, JSONNode root) {
 			StringBuilder sb = new StringBuilder ();
Index: /binary-improvements/MapRendering/Web/ConnectionHandler.cs
===================================================================
--- /binary-improvements/MapRendering/Web/ConnectionHandler.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/ConnectionHandler.cs	(revision 326)
@@ -5,9 +5,4 @@
 	public class ConnectionHandler {
 		private readonly Dictionary<string, WebConnection> connections = new Dictionary<string, WebConnection> ();
-		private Web parent;
-
-		public ConnectionHandler (Web _parent) {
-			parent = _parent;
-		}
 
 		public WebConnection IsLoggedIn (string _sessionId, string _endpoint) {
Index: /binary-improvements/MapRendering/Web/Handlers/ApiHandler.cs
===================================================================
--- /binary-improvements/MapRendering/Web/Handlers/ApiHandler.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/Handlers/ApiHandler.cs	(revision 326)
@@ -7,5 +7,5 @@
 namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
 	public class ApiHandler : PathHandler {
-		private readonly Dictionary<string, WebAPI> apis = new Dictionary<string, WebAPI> ();
+		private readonly Dictionary<string, WebAPI> apis = new CaseInsensitiveStringDictionary<WebAPI> ();
 		private readonly string staticPart;
 
@@ -18,5 +18,5 @@
 					if (ctor != null) {
 						WebAPI apiInstance = (WebAPI) ctor.Invoke (new object [0]);
-						addApi (t.Name.ToLower (), apiInstance);
+						addApi (apiInstance.Name, apiInstance);
 					}
 				}
@@ -52,18 +52,17 @@
 			}
 
-			foreach (KeyValuePair<string, WebAPI> kvp in apis) {
-				if (apiName.StartsWith (kvp.Key)) {
-					try {
-						kvp.Value.HandleRequest (req, resp, user, permissionLevel);
-						return;
-					} catch (Exception e) {
-						Log.Error ("Error in ApiHandler.HandleRequest(): Handler {0} threw an exception:", kvp.Key);
-						Log.Exception (e);
-						resp.StatusCode = (int) HttpStatusCode.InternalServerError;
-						return;
-					}
+			WebAPI api;
+			if (apis.TryGetValue (apiName, out api)) {
+				try {
+					api.HandleRequest (req, resp, user, permissionLevel);
+					return;
+				} catch (Exception e) {
+					Log.Error ("Error in ApiHandler.HandleRequest(): Handler {0} threw an exception:", api.Name);
+					Log.Exception (e);
+					resp.StatusCode = (int) HttpStatusCode.InternalServerError;
+					return;
 				}
 			}
-
+			
 			Log.Out ("Error in ApiHandler.HandleRequest(): No handler found for API \"" + apiName + "\"");
 			resp.StatusCode = (int) HttpStatusCode.NotFound;
Index: /binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs
===================================================================
--- /binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs	(revision 326)
@@ -37,5 +37,5 @@
 			requestFileName = requestFileName.Remove (requestFileName.LastIndexOf ('.'));
 
-			if (icons.ContainsKey (requestFileName) && req.Url.AbsolutePath.ToLower ().EndsWith (".png")) {
+			if (icons.ContainsKey (requestFileName) && req.Url.AbsolutePath.EndsWith (".png", StringComparison.OrdinalIgnoreCase)) {
 				resp.ContentType = MimeType.GetMimeType (".png");
 
@@ -128,5 +128,5 @@
 							foreach (string file in Directory.GetFiles (modIconsPath)) {
 								try {
-									if (file.ToLower ().EndsWith (".png")) {
+									if (file.EndsWith (".png", StringComparison.OrdinalIgnoreCase)) {
 										string name = Path.GetFileNameWithoutExtension (file);
 										Texture2D tex = new Texture2D (1, 1, TextureFormat.ARGB32, false);
Index: /binary-improvements/MapRendering/Web/LogBuffer.cs
===================================================================
--- /binary-improvements/MapRendering/Web/LogBuffer.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/LogBuffer.cs	(revision 326)
@@ -15,4 +15,10 @@
 
 		private int listOffset;
+
+		public static void Init () {
+			if (instance == null) {
+				instance = new LogBuffer ();
+			};
+		}
 
 		private LogBuffer () {
Index: /binary-improvements/MapRendering/Web/OpenID.cs
===================================================================
--- /binary-improvements/MapRendering/Web/OpenID.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/OpenID.cs	(revision 326)
@@ -87,5 +87,5 @@
 						}
 
-						if (chainStatus.Status == X509ChainStatusFlags.UntrustedRoot && chainEl.Certificate == caCert) {
+						if (chainStatus.Status == X509ChainStatusFlags.UntrustedRoot && chainEl.Certificate.Equals (caCert)) {
 							// This status is about the cert being an untrusted root certificate but the certificate is one of those we added, ignore
 							continue;
@@ -149,5 +149,5 @@
 
 			string steamIdString = getValue (_req, "openid.claimed_id");
-			ulong steamId = 0;
+			ulong steamId;
 			Match steamIdMatch = steamIdUrlMatcher.Match (steamIdString);
 			if (steamIdMatch.Success) {
@@ -190,5 +190,5 @@
 
 			HttpWebResponse response = (HttpWebResponse) request.GetResponse ();
-			string responseString = null;
+			string responseString;
 			using (Stream st = response.GetResponseStream ()) {
 				using (StreamReader str = new StreamReader (st)) {
@@ -197,5 +197,5 @@
 			}
 
-			if (responseString.ToLower ().Contains ("is_valid:true")) {
+			if (responseString.ContainsCaseInsensitive ("is_valid:true")) {
 				return steamId;
 			}
Index: /binary-improvements/MapRendering/Web/Web.cs
===================================================================
--- /binary-improvements/MapRendering/Web/Web.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/Web.cs	(revision 326)
@@ -107,5 +107,5 @@
 				);
 
-				connectionHandler = new ConnectionHandler (this);
+				connectionHandler = new ConnectionHandler ();
 
 				_listener.Prefixes.Add (string.Format ("http://*:{0}/", webPort + 2));
@@ -149,82 +149,84 @@
 
 		private void HandleRequest (IAsyncResult result) {
-			if (_listener.IsListening) {
-				Interlocked.Increment (ref handlingCount);
-				Interlocked.Increment (ref currentHandlers);
+			if (!_listener.IsListening) {
+				return;
+			}
+
+			Interlocked.Increment (ref handlingCount);
+			Interlocked.Increment (ref currentHandlers);
 
 //				MicroStopwatch msw = new MicroStopwatch ();
-				HttpListenerContext ctx = _listener.EndGetContext (result);
-				_listener.BeginGetContext (HandleRequest, _listener);
-				try {
-					HttpListenerRequest request = ctx.Request;
-					HttpListenerResponse response = ctx.Response;
-					response.SendChunked = false;
-
-					response.ProtocolVersion = new Version ("1.1");
-
-					WebConnection conn;
-					int permissionLevel = DoAuthentication (request, out conn);
-
-
-					//Log.Out ("Login status: conn!=null: {0}, permissionlevel: {1}", conn != null, permissionLevel);
-
-
-					if (conn != null) {
-						Cookie cookie = new Cookie ("sid", conn.SessionID, "/");
-						cookie.Expired = false;
-						cookie.Expires = new DateTime (2020, 1, 1);
-						cookie.HttpOnly = true;
-						cookie.Secure = false;
-						response.AppendCookie (cookie);
-					}
-
-					// No game yet -> fail request
-					if (GameManager.Instance.World == null) {
-						response.StatusCode = (int) HttpStatusCode.ServiceUnavailable;
-						return;
-					}
-
-					if (request.Url.AbsolutePath.Length < 2) {
-						handlers ["/index.htm"].HandleRequest (request, response, conn, permissionLevel);
-						return;
-					} else {
-						foreach (KeyValuePair<string, PathHandler> kvp in handlers) {
-							if (request.Url.AbsolutePath.StartsWith (kvp.Key)) {
-								if (!kvp.Value.IsAuthorizedForHandler (conn, permissionLevel)) {
-									response.StatusCode = (int) HttpStatusCode.Forbidden;
-									if (conn != null) {
-										//Log.Out ("Web.HandleRequest: user '{0}' not allowed to access '{1}'", conn.SteamID, kvp.Value.ModuleName);
-									}
-								} else {
-									kvp.Value.HandleRequest (request, response, conn, permissionLevel);
+			HttpListenerContext ctx = _listener.EndGetContext (result);
+			_listener.BeginGetContext (HandleRequest, _listener);
+			try {
+				HttpListenerRequest request = ctx.Request;
+				HttpListenerResponse response = ctx.Response;
+				response.SendChunked = false;
+
+				response.ProtocolVersion = new Version ("1.1");
+
+				WebConnection conn;
+				int permissionLevel = DoAuthentication (request, out conn);
+
+
+				//Log.Out ("Login status: conn!=null: {0}, permissionlevel: {1}", conn != null, permissionLevel);
+
+
+				if (conn != null) {
+					Cookie cookie = new Cookie ("sid", conn.SessionID, "/");
+					cookie.Expired = false;
+					cookie.Expires = new DateTime (2020, 1, 1);
+					cookie.HttpOnly = true;
+					cookie.Secure = false;
+					response.AppendCookie (cookie);
+				}
+
+				// No game yet -> fail request
+				if (GameManager.Instance.World == null) {
+					response.StatusCode = (int) HttpStatusCode.ServiceUnavailable;
+					return;
+				}
+
+				if (request.Url.AbsolutePath.Length < 2) {
+					handlers ["/index.htm"].HandleRequest (request, response, conn, permissionLevel);
+					return;
+				} else {
+					foreach (KeyValuePair<string, PathHandler> kvp in handlers) {
+						if (request.Url.AbsolutePath.StartsWith (kvp.Key)) {
+							if (!kvp.Value.IsAuthorizedForHandler (conn, permissionLevel)) {
+								response.StatusCode = (int) HttpStatusCode.Forbidden;
+								if (conn != null) {
+									//Log.Out ("Web.HandleRequest: user '{0}' not allowed to access '{1}'", conn.SteamID, kvp.Value.ModuleName);
 								}
-
-								return;
+							} else {
+								kvp.Value.HandleRequest (request, response, conn, permissionLevel);
 							}
+
+							return;
 						}
 					}
-
-					// Not really relevant for non-debugging purposes:
-					//Log.Out ("Error in Web.HandleRequest(): No handler found for path \"" + request.Url.AbsolutePath + "\"");
-					response.StatusCode = (int) HttpStatusCode.NotFound;
-				} catch (IOException e) {
-					if (e.InnerException is SocketException) {
-						Log.Out ("Error in Web.HandleRequest(): Remote host closed connection: " +
-						         e.InnerException.Message);
-					} else {
-						Log.Out ("Error (IO) in Web.HandleRequest(): " + e);
-					}
-				} catch (Exception e) {
-					Log.Out ("Error in Web.HandleRequest(): " + e);
-				} finally {
-					if (ctx != null && !ctx.Response.SendChunked) {
-						ctx.Response.Close ();
-					}
+				}
+
+				// Not really relevant for non-debugging purposes:
+				//Log.Out ("Error in Web.HandleRequest(): No handler found for path \"" + request.Url.AbsolutePath + "\"");
+				response.StatusCode = (int) HttpStatusCode.NotFound;
+			} catch (IOException e) {
+				if (e.InnerException is SocketException) {
+					Log.Out ("Error in Web.HandleRequest(): Remote host closed connection: " +
+					         e.InnerException.Message);
+				} else {
+					Log.Out ("Error (IO) in Web.HandleRequest(): " + e);
+				}
+			} catch (Exception e) {
+				Log.Out ("Error in Web.HandleRequest(): " + e);
+			} finally {
+				if (ctx != null && !ctx.Response.SendChunked) {
+					ctx.Response.Close ();
+				}
 
 //					msw.Stop ();
 //					totalHandlingTime += msw.ElapsedMicroseconds;
 //					Log.Out ("Web.HandleRequest(): Took {0} µs", msw.ElapsedMicroseconds);
-					Interlocked.Decrement (ref currentHandlers);
-				}
+				Interlocked.Decrement (ref currentHandlers);
 			}
 		}
Index: /binary-improvements/MapRendering/Web/WebConnection.cs
===================================================================
--- /binary-improvements/MapRendering/Web/WebConnection.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/WebConnection.cs	(revision 326)
@@ -6,5 +6,5 @@
 	public class WebConnection : ConsoleConnectionAbstract {
 		private readonly DateTime login;
-		private readonly List<string> outputLines = new List<string> ();
+//		private readonly List<string> outputLines = new List<string> ();
 		private DateTime lastAction;
 		private readonly string conDescription;
@@ -30,17 +30,12 @@
 
 		public static bool CanViewAllPlayers (int _permissionLevel) {
-			bool val = false;
+			const int defaultPermissionLevel = 0;
 
-			try {
-				const int defaultPermissionLevel = 0;
+			bool val = _permissionLevel <= defaultPermissionLevel;
 
-				val = _permissionLevel <= defaultPermissionLevel;
-
-				foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) {
-					if (wap.module.Trim ().ToLower () == "webapi.viewallplayers") {
-						val = _permissionLevel <= wap.permissionLevel;
-					}
+			foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) {
+				if (wap.module.EqualsCaseInsensitive ("webapi.viewallplayers")) {
+					val = _permissionLevel <= wap.permissionLevel;
 				}
-			} catch {
 			}
 
@@ -49,17 +44,12 @@
 
 		public static bool CanViewAllClaims (int _permissionLevel) {
-			bool val = false;
+			const int defaultPermissionLevel = 0;
 
-			try {
-				const int defaultPermissionLevel = 0;
+			bool val = _permissionLevel <= defaultPermissionLevel;
 
-				val = _permissionLevel <= defaultPermissionLevel;
-
-				foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) {
-					if (wap.module.Trim ().ToLower () == "webapi.viewallclaims") {
-						val = _permissionLevel <= wap.permissionLevel;
-					}
+			foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) {
+				if (wap.module.EqualsCaseInsensitive ("webapi.viewallclaims")) {
+					val = _permissionLevel <= wap.permissionLevel;
 				}
-			} catch {
 			}
 
@@ -76,9 +66,9 @@
 
 		public override void SendLine (string _text) {
-			outputLines.Add (_text);
+//			outputLines.Add (_text);
 		}
 
 		public override void SendLines (List<string> _output) {
-			outputLines.AddRange (_output);
+//			outputLines.AddRange (_output);
 		}
 
Index: /binary-improvements/MapRendering/Web/WebPermissions.cs
===================================================================
--- /binary-improvements/MapRendering/Web/WebPermissions.cs	(revision 325)
+++ /binary-improvements/MapRendering/Web/WebPermissions.cs	(revision 326)
@@ -12,8 +12,8 @@
 			new Dictionary<string, WebModulePermission> ();
 
-		private Dictionary<string, AdminToken> admintokens;
+		private readonly Dictionary<string, AdminToken> admintokens = new CaseInsensitiveStringDictionary<AdminToken> ();
 		private FileSystemWatcher fileWatcher;
 
-		private Dictionary<string, WebModulePermission> modules;
+		private readonly Dictionary<string, WebModulePermission> modules = new CaseInsensitiveStringDictionary<WebModulePermission> ();
 
 		public WebPermissions () {
@@ -49,6 +49,7 @@
 
 		public WebModulePermission GetModulePermission (string _module) {
-			if (modules.ContainsKey (_module.ToLower ())) {
-				return modules [_module.ToLower ()];
+			WebModulePermission result;
+			if (modules.TryGetValue (_module, out result)) {
+				return result;
 			}
 
@@ -83,5 +84,5 @@
 		public AdminToken[] GetAdmins () {
 			AdminToken[] result = new AdminToken[admintokens.Count];
-			admintokens.Values.CopyTo (result, 0);
+			admintokens.CopyValuesTo (result);
 			return result;
 		}
@@ -90,5 +91,5 @@
 		// Commands
 		public void AddModulePermission (string _module, int _permissionLevel, bool _save = true) {
-			WebModulePermission p = new WebModulePermission (_module.ToLower (), _permissionLevel);
+			WebModulePermission p = new WebModulePermission (_module, _permissionLevel);
 			lock (this) {
 				modules [_module] = p;
@@ -100,13 +101,15 @@
 
 		public void AddKnownModule (string _module, int _defaultPermission) {
-			if (!string.IsNullOrEmpty (_module)) {
-				lock (this) {
-					if (!IsKnownModule (_module)) {
-						knownModules.Add (_module, new WebModulePermission (_module, _defaultPermission));
-					}
-
-					if (_defaultPermission > 0 && !modules.ContainsKey (_module.ToLower ())) {
-						AddModulePermission (_module, _defaultPermission);
-					}
+			if (string.IsNullOrEmpty (_module)) {
+				return;
+			}
+
+			lock (this) {
+				if (!IsKnownModule (_module)) {
+					knownModules.Add (_module, new WebModulePermission (_module, _defaultPermission));
+				}
+
+				if (_defaultPermission > 0 && !modules.ContainsKey (_module)) {
+					AddModulePermission (_module, _defaultPermission);
 				}
 			}
@@ -114,16 +117,17 @@
 
 		public bool IsKnownModule (string _module) {
-			if (!string.IsNullOrEmpty (_module)) {
-				lock (this) {
-					return knownModules.ContainsKey (_module);
-				}
-			}
-
-			return false;
+			if (string.IsNullOrEmpty (_module)) {
+				return false;
+			}
+
+			lock (this) {
+				return knownModules.ContainsKey (_module);
+			}
+
 		}
 
 		public void RemoveModulePermission (string _module, bool _save = true) {
 			lock (this) {
-				modules.Remove (_module.ToLower ());
+				modules.Remove (_module);
 				if (_save) {
 					Save ();
@@ -174,6 +178,6 @@
 
 		public void Load () {
-			admintokens = new Dictionary<string, AdminToken> ();
-			modules = new Dictionary<string, WebModulePermission> ();
+			admintokens.Clear ();
+			modules.Clear ();
 
 			if (!Utils.FileExists (GetFullPath ())) {
@@ -190,5 +194,5 @@
 				xmlDoc.Load (GetFullPath ());
 			} catch (XmlException e) {
-				Log.Error (string.Format ("Failed loading permissions file: {0}", e.Message));
+				Log.Error ("Failed loading permissions file: " + e.Message);
 				return;
 			}
@@ -196,4 +200,9 @@
 			XmlNode adminToolsNode = xmlDoc.DocumentElement;
 
+			if (adminToolsNode == null) {
+				Log.Error ("Failed loading permissions file: No DocumentElement found");
+				return;
+			}
+			
 			foreach (XmlNode childNode in adminToolsNode.ChildNodes) {
 				if (childNode.Name == "admintokens") {
@@ -230,5 +239,5 @@
 						string name = lineItem.GetAttribute ("name");
 						string token = lineItem.GetAttribute ("token");
-						int permissionLevel = 2000;
+						int permissionLevel;
 						if (!int.TryParse (lineItem.GetAttribute ("permission_level"), out permissionLevel)) {
 							Log.Warning (
@@ -267,5 +276,5 @@
 						}
 
-						int permissionLevel = 0;
+						int permissionLevel;
 						if (!int.TryParse (lineItem.GetAttribute ("permission_level"), out permissionLevel)) {
 							Log.Warning (
@@ -275,5 +284,5 @@
 						}
 
-						AddModulePermission (lineItem.GetAttribute ("module").ToLower (), permissionLevel, false);
+						AddModulePermission (lineItem.GetAttribute ("module"), permissionLevel, false);
 					}
 				}
