diff --git a/src/game/loadgame.cpp b/src/game/loadgame.cpp
index fbbf85d62..76bb158ec 100644
--- a/src/game/loadgame.cpp
+++ b/src/game/loadgame.cpp
@@ -73,6 +73,7 @@ global void CleanModules(void)
 
     CleanIcons();
     CleanCursors();
+    // CleanMenus();
     CleanUserInterface();
     CleanCampaign();
     CleanTriggers();
@@ -116,6 +117,7 @@ global void InitModules(void)
     InitIcons();
     InitVideoCursors();
     InitUserInterface(RaceWcNames ? RaceWcNames[1] : "oops");
+    // InitMenus();
     InitPlayers();
     InitMissileTypes();
     InitMissiles();
diff --git a/src/include/menus.h b/src/include/menus.h
index be9f05e17..4805a42cf 100644
--- a/src/include/menus.h
+++ b/src/include/menus.h
@@ -259,6 +259,11 @@ extern char **KeyStrokeHelps;		/// Keystroke help pairs
 
 #define MENUS_MAXMENU 128		/// FIXME: wrong place, docu
 #define MENUS_MAXFUNC 128		/// FIXME: wrong place, docu
+
+#ifdef DOXYGEN                          // no real code, only for document
+
+#else
+
     /// FIXME: docu
 typedef hashtable(Menu*,MENUS_MAXMENU) _MenuHash;
 extern _MenuHash MenuHash;
@@ -266,6 +271,8 @@ extern _MenuHash MenuHash;
 typedef hashtable(void*,MENUS_MAXFUNC) _MenuFuncHash;
 extern _MenuFuncHash MenuFuncHash;
 
+#endif
+
 /*----------------------------------------------------------------------------
 --	Functions
 ----------------------------------------------------------------------------*/
diff --git a/src/include/ui.h b/src/include/ui.h
index 0f16fa3b1..bdc1616f2 100644
--- a/src/include/ui.h
+++ b/src/include/ui.h
@@ -320,6 +320,8 @@ extern void UIHandleButtonDown(unsigned button);
     /// Called if any mouse button is released up
 extern void UIHandleButtonUp(unsigned button);
 
+    /// Restrict mouse cursor to viewport
+extern void RestrictCursorToViewport(void);
     /// Restrict mouse cursor to minimap
 extern void RestrictCursorToMinimap(void);
 
diff --git a/src/ui/menus.cpp b/src/ui/menus.cpp
index 9dd98711e..9a1252e08 100644
--- a/src/ui/menus.cpp
+++ b/src/ui/menus.cpp
@@ -4302,7 +4302,6 @@ local void StartEditor(void)
     GetInfoFromSelectPath();
 
     ProcessMenu("menu-editor-select", 1);
-
 }
 
 local void EditorNewMap(void)
@@ -4314,6 +4313,7 @@ local void EditorNewMap(void)
     // FIXME: currently just loads default.pud
     strcpy(CurrentMapPath, "default.pud");
 
+    // FIXME: Use EditorRunning and main-loop.
     EditorMainLoop();
     EndMenu();
 }
@@ -4347,6 +4347,7 @@ local void EditorLoadMap(void)
 	strcat(ScenSelectPath, ScenSelectFileName);	// Final map name with path
     }
 
+    // FIXME: Use EditorRunning and main-loop.
     EditorMainLoop();
     EndMenu();
 }
diff --git a/src/ui/mouse.cpp b/src/ui/mouse.cpp
index 20ddbab2d..18f7e25da 100644
--- a/src/ui/mouse.cpp
+++ b/src/ui/mouse.cpp
@@ -568,37 +568,61 @@ global void HandleMouseExit(void)
     GameCursor = TheUI.Point.Cursor;
 }
 
+/**
+**	Restrict mouse cursor to viewport.
+*/
+global void RestrictCursorToViewport(void)
+{
+    const Viewport *vp;
+
+    vp = &TheUI.VP[TheUI.LastClickedVP];
+    if (CursorX < vp->X) {
+	CursorStartX = vp->X;
+    } else if (CursorX >= vp->EndX) {
+	CursorStartX = vp->EndX - 1;
+    } else {
+	CursorStartX = CursorX;
+    }
+
+    if (CursorY < vp->Y) {
+	CursorStartY = vp->Y;
+    } else if (CursorY >= vp->EndY) {
+	CursorStartY = vp->EndY - 1;
+    } else {
+	CursorStartY = CursorY;
+    }
+
+    TheUI.WarpX = CursorX = CursorStartX;
+    TheUI.WarpY = CursorY = CursorStartY;
+    CursorOn = CursorOnMap;
+}
+
 /**
 **	Restrict mouse cursor to minimap
 */
 global void RestrictCursorToMinimap(void)
 {
-    if( CursorX<TheUI.MinimapX+24 ) {
-	CursorStartX=TheUI.MinimapX+24;
-    }
-    else if( CursorX>=TheUI.MinimapX+24+MINIMAP_W ) {
-	CursorStartX=TheUI.MinimapX+24+MINIMAP_W-1;
-    }
-    else {
-	CursorStartX=CursorX;
+    if (CursorX < TheUI.MinimapX + 24) {
+	CursorStartX = TheUI.MinimapX + 24;
+    } else if (CursorX >= TheUI.MinimapX + 24 + MINIMAP_W) {
+	CursorStartX = TheUI.MinimapX + 24 + MINIMAP_W - 1;
+    } else {
+	CursorStartX = CursorX;
     }
 
-    if( CursorY<TheUI.MinimapY+2 ) {
-	CursorStartY=TheUI.MinimapY+2;
-    }
-    else if( CursorY>=TheUI.MinimapY+2+MINIMAP_H ) {
-	CursorStartY=TheUI.MinimapY+2+MINIMAP_H-1;
-    }
-    else {
-	CursorStartY=CursorY;
+    if (CursorY < TheUI.MinimapY + 2) {
+	CursorStartY = TheUI.MinimapY + 2;
+    } else if (CursorY >= TheUI.MinimapY + 2 + MINIMAP_H) {
+	CursorStartY = TheUI.MinimapY + 2 + MINIMAP_H - 1;
+    } else {
+	CursorStartY = CursorY;
     }
 
-    CursorX=TheUI.WarpX=CursorStartX;
-    CursorY=TheUI.WarpY=CursorStartY;
-    CursorOn=CursorOnMinimap;
+    CursorX = TheUI.WarpX = CursorStartX;
+    CursorY = TheUI.WarpY = CursorStartY;
+    CursorOn = CursorOnMinimap;
 }
 
-
 /**
 **	Handle movement of the cursor.
 **