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);
 			}
 
