Index: binary-improvements/MapRendering/Web/Handlers/ApiHandler.cs
===================================================================
--- binary-improvements/MapRendering/Web/Handlers/ApiHandler.cs	(revision 311)
+++ binary-improvements/MapRendering/Web/Handlers/ApiHandler.cs	(revision 325)
@@ -1,15 +1,12 @@
-using AllocsFixes.NetConnections.Servers.Web.API;
 using System;
 using System.Collections.Generic;
-using System.IO;
 using System.Net;
 using System.Reflection;
-using System.Threading;
+using AllocsFixes.NetConnections.Servers.Web.API;
 
-namespace AllocsFixes.NetConnections.Servers.Web.Handlers
-{
+namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
 	public class ApiHandler : PathHandler {
-		private string staticPart;
-		private Dictionary<String, WebAPI> apis = new Dictionary<string, WebAPI> ();
+		private readonly Dictionary<string, WebAPI> apis = new Dictionary<string, WebAPI> ();
+		private readonly string staticPart;
 
 		public ApiHandler (string staticPart, string moduleName = null) : base (moduleName) {
@@ -17,8 +14,8 @@
 
 			foreach (Type t in Assembly.GetExecutingAssembly ().GetTypes ()) {
-				if (!t.IsAbstract && t.IsSubclassOf (typeof(WebAPI))) {
+				if (!t.IsAbstract && t.IsSubclassOf (typeof (WebAPI))) {
 					ConstructorInfo ctor = t.GetConstructor (new Type [0]);
 					if (ctor != null) {
-						WebAPI apiInstance = (WebAPI)ctor.Invoke (new object [0]);
+						WebAPI apiInstance = (WebAPI) ctor.Invoke (new object [0]);
 						addApi (t.Name.ToLower (), apiInstance);
 					}
@@ -26,14 +23,14 @@
 			}
 
-            // Add dummy types
-            Type dummy_t = typeof (API.Null);
-            ConstructorInfo dummy_ctor = dummy_t.GetConstructor (new Type [0]);
-            if (dummy_ctor != null) {
-                WebAPI dummy_apiInstance = (WebAPI)dummy_ctor.Invoke (new object[0]);
+			// Add dummy types
+			Type dummy_t = typeof (Null);
+			ConstructorInfo dummy_ctor = dummy_t.GetConstructor (new Type [0]);
+			if (dummy_ctor != null) {
+				WebAPI dummy_apiInstance = (WebAPI) dummy_ctor.Invoke (new object[0]);
 
-                // Permissions that don't map to a real API
-                addApi("viewallclaims", dummy_apiInstance);
-                addApi("viewallplayers", dummy_apiInstance);
-            }
+				// Permissions that don't map to a real API
+				addApi ("viewallclaims", dummy_apiInstance);
+				addApi ("viewallplayers", dummy_apiInstance);
+			}
 		}
 
@@ -43,32 +40,32 @@
 		}
 
-		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) {
+		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user,
+			int permissionLevel) {
 			string apiName = req.Url.AbsolutePath.Remove (0, staticPart.Length);
 			if (!AuthorizeForCommand (apiName, user, permissionLevel)) {
-				resp.StatusCode = (int)HttpStatusCode.Forbidden;
+				resp.StatusCode = (int) HttpStatusCode.Forbidden;
 				if (user != null) {
 					//Log.Out ("ApiHandler: user '{0}' not allowed to execute '{1}'", user.SteamID, apiName);
-				} else {
-					//Log.Out ("ApiHandler: unidentified user from '{0}' not allowed to execute '{1}'", req.RemoteEndPoint.Address, apiName);
 				}
+
 				return;
-			} else {
-				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;
-						}
+			}
+
+			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;
 					}
 				}
 			}
-	
+
 			Log.Out ("Error in ApiHandler.HandleRequest(): No handler found for API \"" + apiName + "\"");
-			resp.StatusCode = (int)HttpStatusCode.NotFound;
+			resp.StatusCode = (int) HttpStatusCode.NotFound;
 		}
 
@@ -76,7 +73,4 @@
 			return WebPermissions.Instance.ModuleAllowedWithLevel ("webapi." + apiName, permissionLevel);
 		}
-
 	}
-
 }
-
Index: binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs
===================================================================
--- binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs	(revision 311)
+++ binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs	(revision 325)
@@ -1,32 +1,33 @@
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Net;
-using System.Threading;
+using UnityEngine;
+using Object = UnityEngine.Object;
 
-using UnityEngine;
-using System.IO;
+namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
+	public class ItemIconHandler : PathHandler {
+		private readonly Dictionary<string, byte[]> icons = new Dictionary<string, byte[]> ();
+		private readonly bool logMissingFiles;
 
-namespace AllocsFixes.NetConnections.Servers.Web.Handlers
-{
-	public class ItemIconHandler : PathHandler {
-		private static ItemIconHandler instance = null;
-		public static ItemIconHandler Instance {
-			get { return instance; }
+		private readonly string staticPart;
+		private bool loaded;
+
+		static ItemIconHandler () {
+			Instance = null;
 		}
 
-		private string staticPart;
-		private bool logMissingFiles;
-		private Dictionary<string, byte[]> icons = new Dictionary<string, byte[]> ();
-		private bool loaded = false;
-
-		public ItemIconHandler (string staticPart, bool logMissingFiles, string moduleName = null) : base(moduleName) {
+		public ItemIconHandler (string staticPart, bool logMissingFiles, string moduleName = null) : base (moduleName) {
 			this.staticPart = staticPart;
 			this.logMissingFiles = logMissingFiles;
-			ItemIconHandler.instance = this;
+			Instance = this;
 		}
 
-		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) {
+		public static ItemIconHandler Instance { get; private set; }
+
+		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user,
+			int permissionLevel) {
 			if (!loaded) {
-				resp.StatusCode = (int)HttpStatusCode.InternalServerError;
+				resp.StatusCode = (int) HttpStatusCode.InternalServerError;
 				Log.Out ("Web:IconHandler: Icons not loaded");
 				return;
@@ -44,9 +45,8 @@
 				resp.OutputStream.Write (itemIconData, 0, itemIconData.Length);
 			} else {
-				resp.StatusCode = (int)HttpStatusCode.NotFound;
+				resp.StatusCode = (int) HttpStatusCode.NotFound;
 				if (logMissingFiles) {
 					Log.Out ("Web:IconHandler:FileNotFound: \"" + req.Url.AbsolutePath + "\" ");
 				}
-				return;
 			}
 		}
@@ -66,4 +66,5 @@
 					return false;
 				}
+
 				DynamicUIAtlas atlas = atlasObj.GetComponent<DynamicUIAtlas> ();
 				if (atlas == null) {
@@ -78,5 +79,6 @@
 				Texture2D atlasTex;
 
-				if (!DynamicUIAtlasTools.ReadPrebakedAtlasDescriptor (textureResourceName, out sprites, out elementWidth, out elementHeight)) {
+				if (!DynamicUIAtlasTools.ReadPrebakedAtlasDescriptor (textureResourceName, out sprites,
+					out elementWidth, out elementHeight)) {
 					SdtdConsole.Instance.Output ("Web:IconHandler: Could not read dynamic atlas descriptor");
 					return false;
@@ -98,4 +100,5 @@
 								tintedIcons.Add (name, new List<Color> ());
 							}
+
 							List<Color> list = tintedIcons [name];
 							list.Add (tintColor);
@@ -108,11 +111,13 @@
 					string name = data.name;
 					Texture2D tex = new Texture2D (data.width, data.height, TextureFormat.ARGB32, false);
-					tex.SetPixels (atlasTex.GetPixels (data.x, atlasTex.height - data.height - data.y, data.width, data.height));
+					tex.SetPixels (atlasTex.GetPixels (data.x, atlasTex.height - data.height - data.y, data.width,
+						data.height));
 
 					AddIcon (name, tex, tintedIcons);
 
-					UnityEngine.Object.Destroy (tex);
+					Object.Destroy (tex);
 				}
-				Resources.UnloadAsset(atlasTex);
+
+				Resources.UnloadAsset (atlasTex);
 
 				// Load icons from mods
@@ -131,5 +136,5 @@
 											}
 
-											UnityEngine.Object.Destroy (tex);
+											Object.Destroy (tex);
 										}
 									}
@@ -168,11 +173,9 @@
 						icons [tintedName] = tintedTex.EncodeToPNG ();
 
-						UnityEngine.Object.Destroy (tintedTex);
+						Object.Destroy (tintedTex);
 					}
 				}
 			}
 		}
-
 	}
 }
-
Index: binary-improvements/MapRendering/Web/Handlers/PathHandler.cs
===================================================================
--- binary-improvements/MapRendering/Web/Handlers/PathHandler.cs	(revision 311)
+++ binary-improvements/MapRendering/Web/Handlers/PathHandler.cs	(revision 325)
@@ -1,29 +1,27 @@
-using System;
 using System.Net;
 
-namespace AllocsFixes.NetConnections.Servers.Web.Handlers
-{
-	public abstract class PathHandler
-	{
-		private string moduleName = null;
+namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
+	public abstract class PathHandler {
+		private readonly string moduleName;
+
+		protected PathHandler (string _moduleName, int _defaultPermissionLevel = 0) {
+			moduleName = _moduleName;
+			WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
+		}
+
 		public string ModuleName {
 			get { return moduleName; }
 		}
 
-		protected PathHandler (string _moduleName, int _defaultPermissionLevel = 0) {
-			this.moduleName = _moduleName;
-			WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
-		}
-
-		public abstract void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel);
+		public abstract void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user,
+			int permissionLevel);
 
 		public bool IsAuthorizedForHandler (WebConnection user, int permissionLevel) {
 			if (moduleName != null) {
 				return WebPermissions.Instance.ModuleAllowedWithLevel (moduleName, permissionLevel);
-			} else {
-				return true;
 			}
+
+			return true;
 		}
 	}
 }
-
Index: binary-improvements/MapRendering/Web/Handlers/SessionHandler.cs
===================================================================
--- binary-improvements/MapRendering/Web/Handlers/SessionHandler.cs	(revision 311)
+++ binary-improvements/MapRendering/Web/Handlers/SessionHandler.cs	(revision 325)
@@ -1,20 +1,17 @@
-using System;
-using System.Collections.Generic;
 using System.IO;
 using System.Net;
 using System.Text;
-using System.Threading;
 
-namespace AllocsFixes.NetConnections.Servers.Web.Handlers
-{
+namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
 	public class SessionHandler : PathHandler {
-		private string staticPart;
-		private Web parent;
-		private string header = "";
-		private string footer = "";
+		private readonly string footer = "";
+		private readonly string header = "";
+		private readonly Web parent;
+		private readonly string staticPart;
 
-		public SessionHandler (string _staticPart, string _dataFolder, Web _parent, string moduleName = null) : base(moduleName) {
-			this.staticPart = _staticPart;
-			this.parent = _parent;
+		public SessionHandler (string _staticPart, string _dataFolder, Web _parent, string moduleName = null) :
+			base (moduleName) {
+			staticPart = _staticPart;
+			parent = _parent;
 
 			if (File.Exists (_dataFolder + "/sessionheader.tmpl")) {
@@ -27,5 +24,6 @@
 		}
 
-		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) {
+		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user,
+			int permissionLevel) {
 			string subpath = req.Url.AbsolutePath.Remove (0, staticPart.Length);
 
@@ -37,7 +35,8 @@
 					resp.Redirect ("/static/index.html");
 					return;
-				} else {
-					result.Append ("<h1>Login failed, <a href=\"/static/index.html\">click to return to main page</a>.</h1>");
 				}
+
+				result.Append (
+					"<h1>Login failed, <a href=\"/static/index.html\">click to return to main page</a>.</h1>");
 			} else if (subpath.StartsWith ("logout")) {
 				if (user != null) {
@@ -48,7 +47,8 @@
 					resp.Redirect ("/static/index.html");
 					return;
-				} else {
-					result.Append ("<h1>Not logged in, <a href=\"/static/index.html\">click to return to main page</a>.</h1>");
 				}
+
+				result.Append (
+					"<h1>Not logged in, <a href=\"/static/index.html\">click to return to main page</a>.</h1>");
 			} else if (subpath.StartsWith ("login")) {
 				string host = (Web.isSslRedirected (req) ? "https://" : "http://") + req.UserHostName;
@@ -57,5 +57,6 @@
 				return;
 			} else {
-				result.Append ("<h1>Unknown command, <a href=\"/static/index.html\">click to return to main page</a>.</h1>");
+				result.Append (
+					"<h1>Unknown command, <a href=\"/static/index.html\">click to return to main page</a>.</h1>");
 			}
 
@@ -68,7 +69,4 @@
 			resp.OutputStream.Write (buf, 0, buf.Length);
 		}
-
 	}
-
 }
-
Index: binary-improvements/MapRendering/Web/Handlers/SimpleRedirectHandler.cs
===================================================================
--- binary-improvements/MapRendering/Web/Handlers/SimpleRedirectHandler.cs	(revision 311)
+++ binary-improvements/MapRendering/Web/Handlers/SimpleRedirectHandler.cs	(revision 325)
@@ -1,21 +1,16 @@
-using System;
 using System.Net;
 
-namespace AllocsFixes.NetConnections.Servers.Web.Handlers
-{
-	public class SimpleRedirectHandler : PathHandler
-	{
-		string target;
+namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
+	public class SimpleRedirectHandler : PathHandler {
+		private readonly string target;
 
-		public SimpleRedirectHandler (string target, string moduleName = null) : base(moduleName)
-		{
+		public SimpleRedirectHandler (string target, string moduleName = null) : base (moduleName) {
 			this.target = target;
 		}
 
-		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel)
-		{
+		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user,
+			int permissionLevel) {
 			resp.Redirect (target);
 		}
 	}
 }
-
Index: binary-improvements/MapRendering/Web/Handlers/StaticHandler.cs
===================================================================
--- binary-improvements/MapRendering/Web/Handlers/StaticHandler.cs	(revision 311)
+++ binary-improvements/MapRendering/Web/Handlers/StaticHandler.cs	(revision 325)
@@ -1,27 +1,23 @@
-using System;
-using System.Collections.Generic;
 using System.IO;
 using System.Net;
-using System.Threading;
+using AllocsFixes.FileCache;
 
-namespace AllocsFixes.NetConnections.Servers.Web.Handlers
-{
-	public class StaticHandler : PathHandler
-	{
-		private string datapath;
-		private string staticPart;
-		private AllocsFixes.FileCache.AbstractCache cache;
-		private bool logMissingFiles;
+namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
+	public class StaticHandler : PathHandler {
+		private readonly AbstractCache cache;
+		private readonly string datapath;
+		private readonly bool logMissingFiles;
+		private readonly string staticPart;
 
-		public StaticHandler (string staticPart, string filePath, AllocsFixes.FileCache.AbstractCache cache, bool logMissingFiles, string moduleName = null) : base(moduleName)
-		{
+		public StaticHandler (string staticPart, string filePath, AbstractCache cache, bool logMissingFiles,
+			string moduleName = null) : base (moduleName) {
 			this.staticPart = staticPart;
-			this.datapath = filePath;
+			datapath = filePath;
 			this.cache = cache;
 			this.logMissingFiles = logMissingFiles;
 		}
 
-		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel)
-		{
+		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user,
+			int permissionLevel) {
 			string fn = req.Url.AbsolutePath.Remove (0, staticPart.Length);
 
@@ -33,11 +29,11 @@
 				resp.OutputStream.Write (content, 0, content.Length);
 			} else {
-				resp.StatusCode = (int)HttpStatusCode.NotFound;
-				if (logMissingFiles)
-					Log.Out ("Web:Static:FileNotFound: \"" + req.Url.AbsolutePath + "\" @ \"" + datapath + "/" + req.Url.AbsolutePath.Remove (0, staticPart.Length) + "\"");
-				return;
+				resp.StatusCode = (int) HttpStatusCode.NotFound;
+				if (logMissingFiles) {
+					Log.Out ("Web:Static:FileNotFound: \"" + req.Url.AbsolutePath + "\" @ \"" + datapath + "/" +
+					         req.Url.AbsolutePath.Remove (0, staticPart.Length) + "\"");
+				}
 			}
 		}
 	}
 }
-
Index: binary-improvements/MapRendering/Web/Handlers/UserStatusHandler.cs
===================================================================
--- binary-improvements/MapRendering/Web/Handlers/UserStatusHandler.cs	(revision 311)
+++ binary-improvements/MapRendering/Web/Handlers/UserStatusHandler.cs	(revision 325)
@@ -1,17 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
 using System.Net;
-using System.Threading;
-using System.Text;
 using AllocsFixes.JSON;
+using AllocsFixes.NetConnections.Servers.Web.API;
 
-namespace AllocsFixes.NetConnections.Servers.Web.Handlers
-{
+namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
 	public class UserStatusHandler : PathHandler {
-		public UserStatusHandler (string moduleName = null) : base(moduleName) {
+		public UserStatusHandler (string moduleName = null) : base (moduleName) {
 		}
 
-		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user, int permissionLevel) {
+		public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnection user,
+			int permissionLevel) {
 			JSONObject result = new JSONObject ();
 
@@ -23,14 +19,13 @@
 				JSONObject permObj = new JSONObject ();
 				permObj.Add ("module", new JSONString (perm.module));
-				permObj.Add ("allowed", new JSONBoolean (WebPermissions.Instance.ModuleAllowedWithLevel (perm.module, permissionLevel)));
+				permObj.Add ("allowed",
+					new JSONBoolean (WebPermissions.Instance.ModuleAllowedWithLevel (perm.module, permissionLevel)));
 				perms.Add (permObj);
 			}
+
 			result.Add ("permissions", perms);
 
-			AllocsFixes.NetConnections.Servers.Web.API.WebAPI.WriteJSON (resp, result);
+			WebAPI.WriteJSON (resp, result);
 		}
-
 	}
-
 }
-
