Index: data/media/gui/layouts/PickupInventory.layout
===================================================================
--- data/media/gui/layouts/PickupInventory.layout	(revision 5551)
+++ data/media/gui/layouts/PickupInventory.layout	(revision 5559)
@@ -27,6 +27,6 @@
             </Window>
         </Window>
-        
-        <Event Name="WindowUpdate" Function="frmUpdate" />
+
+        <Event Name="WindowUpdate" Function="PickupInventory.update" />
     </Window>
 </GUILayout>
Index: data/media/gui/scripts/PickupInventory.lua
===================================================================
--- data/media/gui/scripts/PickupInventory.lua	(revision 5551)
+++ data/media/gui/scripts/PickupInventory.lua	(revision 5559)
@@ -1,22 +1,33 @@
-layoutPath = "PickupInventory.layout"
+gui = require("gui")
+local P = gui:new() --inherit everything from the gui package
 
--- variables
-local winMgr = CEGUI.WindowManager:getSingleton()
+PickupInventory = P
 
-local lastEquipmentCount_ = 0
-local lastUsableCount_ = 0
-local currentUsableID_ = 0
+P.filename = "PickupInventory"
+P.layoutString = "PickupInventory.layout"
+
+P.lastEquipmentCount_ = 0
+P.lastUsableCount_ = 0
+P.currentUsableID_ = 0
 
 -- events
-function frmUpdate(e)
+function P:frmUpdate(e)
     local equipCount = orxonox.PickupInventory:getEquipmentCount()
     local usableCount = orxonox.PickupInventory:getUsableCount()
     
-    if equipCount ~= lastEquipmentCount_ or usableCount ~= lastUsableCount_ then
-        updateTabs()
+    if equipCount ~= self.lastEquipmentCount_ or usableCount ~= self.lastUsableCount_ then
+        self:updateTabs()
     end
 end
 
-function itemClicked(e)
+function P.update(e)
+    loadedGUIs["PickupInventory"]:frmUpdate(e)
+end
+
+function P.itemClicked(e)
+    loadedGUIs["PickupInventory"]:mItemClicked(e)
+end
+
+function P:mItemClicked(e)
     local w = CEGUI.toWindowEventArgs(e).window
     local name = w:getName()
@@ -29,9 +40,9 @@
     
     if t == "use" then
-        if currentUsableID_ >= 0 then
-            winMgr:getWindow("orxonox/Inventory/Title/use/" .. currentUsableID_):setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
+        if self.currentUsableID_ >= 0 then
+            winMgr:getWindow("orxonox/Inventory/Title/use/" .. self.currentUsableID_):setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
         end
         orxonox.PickupInventory:selectUsable(tonumber(i))
-        currentUsableID_ = tonumber(i)
+        self.currentUsableID_ = tonumber(i)
         winMgr:getWindow("orxonox/Inventory/Title/use/" .. i):setProperty("TextColours", "tl:FFFF4444 tr:FFFF4444 bl:FFFF4444 br:FFFF4444")
     end
@@ -39,5 +50,5 @@
 
 -- methods
-function updateTabs()
+function P:updateTabs()
     local eqWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabEquipment")
     local usWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabUsable")
@@ -45,6 +56,8 @@
     orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin)
     
-    currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex()
-    lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount()
-    lastUsableCount_ = orxonox.PickupInventory:getUsableCount()
+    self.currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex()
+    self.lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount()
+    self.lastUsableCount_ = orxonox.PickupInventory:getUsableCount()
 end
+
+return PickupInventory
Index: data/media/gui/scripts/gui.lua
===================================================================
--- data/media/gui/scripts/gui.lua	(revision 5551)
+++ data/media/gui/scripts/gui.lua	(revision 5559)
@@ -15,5 +15,4 @@
     setmetatable(newElement, self) -- connects new element with class
     self.__index = self
-    self:init()
     return newElement
 end
@@ -36,5 +35,7 @@
 
 function P:load ()
-    return self:new(winMgr:loadWindowLayout(self.layoutString), self.filename)
+    self.window = winMgr:loadWindowLayout(self.layoutString)
+    self:init()
+    return self
 end
 
Index: data/media/gui/scripts/mainmenu_2.lua
===================================================================
--- data/media/gui/scripts/mainmenu_2.lua	(revision 5551)
+++ data/media/gui/scripts/mainmenu_2.lua	(revision 5559)
@@ -12,4 +12,5 @@
     preselect = orxonox.Game:getInstance():getLevel()
     orxonox.GUIManager:getInstance():getLevelList() --levellist variable ist set now
+    table.sort(levellist)
     for k,v in pairs(levellist) do
         item = CEGUI.createListboxTextItem(v)        
