Index: src/UIElements/CommandLineUI/CommandLineWindow.cpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineWindow.cpp	(revision b800215c062e714dbeab7570ef2a6df003c54c1c)
+++ src/UIElements/CommandLineUI/CommandLineWindow.cpp	(revision b0acc3a7b5b3ca40d4aa3940fd46ba4055624f89)
@@ -13,45 +13,8 @@
 #include "CommandLineUI/CommandLineStatusIndicator.hpp"
 
+#include "Actions/Action.hpp"
+#include "Actions/MapOfActions.hpp"
 #include "Actions/ActionRegistry.hpp"
-#include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
-#include "Actions/AnalysisAction/PairCorrelationAction.hpp"
-#include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
-#include "Actions/AtomAction/AddAction.hpp"
-#include "Actions/AtomAction/ChangeElementAction.hpp"
-#include "Actions/AtomAction/RemoveAction.hpp"
-#include "Actions/CmdAction/BondLengthTableAction.hpp"
-#include "Actions/CmdAction/ElementDbAction.hpp"
-#include "Actions/CmdAction/FastParsingAction.hpp"
-#include "Actions/CmdAction/HelpAction.hpp"
-#include "Actions/CmdAction/VerboseAction.hpp"
-#include "Actions/CmdAction/VersionAction.hpp"
-#include "Actions/FragmentationAction/DepthFirstSearchAction.hpp"
-#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
-#include "Actions/FragmentationAction/FragmentationAction.hpp"
-#include "Actions/MoleculeAction/BondFileAction.hpp"
-#include "Actions/MoleculeAction/ChangeNameAction.hpp"
-#include "Actions/MoleculeAction/FillWithMoleculeAction.hpp"
-#include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp"
-#include "Actions/MoleculeAction/SaveAdjacencyAction.hpp"
-#include "Actions/MoleculeAction/SaveBondsAction.hpp"
-#include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
-#include "Actions/MoleculeAction/TranslateAction.hpp"
-#include "Actions/MoleculeAction/VerletIntegrationAction.hpp"
-#include "Actions/ParserAction/LoadXyzAction.hpp"
-#include "Actions/ParserAction/SaveXyzAction.hpp"
-#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
-#include "Actions/TesselationAction/NonConvexEnvelopeAction.hpp"
-#include "Actions/WorldAction/AddEmptyBoundaryAction.hpp"
-#include "Actions/WorldAction/BoundInBoxAction.hpp"
-#include "Actions/WorldAction/CenterInBoxAction.hpp"
-#include "Actions/WorldAction/CenterOnEdgeAction.hpp"
-#include "Actions/WorldAction/ChangeBoxAction.hpp"
-#include "Actions/WorldAction/InputAction.hpp"
-#include "Actions/WorldAction/OutputAction.hpp"
-#include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp"
-#include "Actions/WorldAction/RepeatBoxAction.hpp"
-#include "Actions/WorldAction/ScaleBoxAction.hpp"
-#include "Actions/WorldAction/SetDefaultNameAction.hpp"
-#include "Actions/WorldAction/SetGaussianBasisAction.hpp"
+
 #include "CommandLineParser.hpp"
 
@@ -64,12 +27,5 @@
 {
   // create and register all command line callable actions
-  populateAnalysisActions();
-  populateAtomActions();
-  populateCmdActions();
-  populateFragmentationActions();
-  populateMoleculeActions();
-  populateParserActions();
-  populateTesselationActions();
-  populateWorldActions();
+  MapOfActions::getInstance().populateActions();
 
   // Add status indicators etc...
@@ -97,73 +53,2 @@
 }
 
-void CommandLineWindow::populateAnalysisActions()
-{
-  new AnalysisMolecularVolumeAction();
-  new AnalysisPairCorrelationAction();
-  new AnalysisPrincipalAxisSystemAction();
-}
-
-void CommandLineWindow::populateAtomActions()
-{
-  new AtomAddAction();
-  new AtomChangeElementAction();
-  new AtomRemoveAction();
-}
-
-void CommandLineWindow::populateCmdActions()
-{
-  new CommandLineBondLengthTableAction();
-  new CommandLineElementDbAction();
-  new CommandLineFastParsingAction();
-  new CommandLineHelpAction();
-  new CommandLineVerboseAction();
-  new CommandLineVersionAction();
-}
-
-void CommandLineWindow::populateFragmentationActions()
-{
-  new FragmentationDepthFirstSearchAction();
-  new FragmentationFragmentationAction();
-  new FragmentationSubgraphDissectionAction();
-}
-
-void CommandLineWindow::populateMoleculeActions()
-{
-  new MoleculeBondFileAction();
-  new MoleculeChangeNameAction();
-  new MoleculeFillWithMoleculeAction();
-  new MoleculeLinearInterpolationofTrajectoriesAction();
-  new MoleculeSaveAdjacencyAction();
-  new MoleculeSaveBondsAction();
-  new MoleculeSaveTemperatureAction();
-  new MoleculeTranslateAction();
-  new MoleculeVerletIntegrationAction();
-}
-
-void CommandLineWindow::populateParserActions()
-{
-  new ParserLoadXyzAction();
-  new ParserSaveXyzAction();
-}
-
-void CommandLineWindow::populateTesselationActions()
-{
-  new TesselationConvexEnvelopeAction();
-  new TesselationNonConvexEnvelopeAction();
-}
-
-void CommandLineWindow::populateWorldActions()
-{
-  new WorldAddEmptyBoundaryAction();
-  new WorldBoundInBoxAction();
-  new WorldCenterInBoxAction();
-  new WorldCenterOnEdgeAction();
-  new WorldChangeBoxAction();
-  new WorldInputAction();
-  new WorldOutputAction();
-  new WorldRemoveSphereOfAtomsAction();
-  new WorldRepeatBoxAction();
-  new WorldScaleBoxAction();
-  new WorldSetDefaultNameAction();
-  new WorldSetGaussianBasisAction();
-}
Index: src/UIElements/TextUI/TextWindow.cpp
===================================================================
--- src/UIElements/TextUI/TextWindow.cpp	(revision b800215c062e714dbeab7570ef2a6df003c54c1c)
+++ src/UIElements/TextUI/TextWindow.cpp	(revision b0acc3a7b5b3ca40d4aa3940fd46ba4055624f89)
@@ -12,25 +12,4 @@
 #include <boost/bind.hpp>
 
-
-// TODO: When done with refactoring most of these wont be needed anymore
-#include "analysis_correlation.hpp"
-#include "atom.hpp"
-#include "bond.hpp"
-#include "bondgraph.hpp"
-#include "boundary.hpp"
-#include "config.hpp"
-#include "element.hpp"
-#include "ellipsoid.hpp"
-#include "helpers.hpp"
-#include "leastsquaremin.hpp"
-#include "linkedcell.hpp"
-#include "log.hpp"
-#include "memoryusageobserver.hpp"
-#include "molecule.hpp"
-#include "periodentafel.hpp"
-#include "World.hpp"
-
-#include "Legacy/oldmenu.hpp"
-
 #include "Menu/Menu.hpp"
 #include "Menu/TextMenu.hpp"
@@ -40,6 +19,6 @@
 #include "Menu/SubMenuItem.hpp"
 #include "TextUI/TextStatusIndicator.hpp"
+#include "Actions/MapOfActions.hpp"
 #include "Actions/MethodAction.hpp"
-#include "Actions/MoleculeAction/ChangeNameAction.hpp"
 #include "Actions/ErrorAction.hpp"
 #include "Actions/ActionRegistry.hpp"
@@ -48,5 +27,17 @@
 #include "Helpers/MemDebug.hpp"
 
+#include "defs.hpp"
+#include "log.hpp"
+#include "verbose.hpp"
+
+// all needed due to config::SaveAll()
+#include "config.hpp"
+#include "periodentafel.hpp"
+
+// config::SaveAll() and enumerate()
+#include "molecule.hpp"
+
 #include <iostream>
+#include <map>
 
 using namespace std;
@@ -55,14 +46,14 @@
 TextWindow::TextWindow()
 {
-  MoleculeListClass *molecules = World::getInstance().getMolecules();
-  config *configuration = World::getInstance().getConfig();
-  periodentafel *periode = World::getInstance().getPeriode();
-  char *ConfigFileName = NULL;
-  old_menu = new oldmenu;
+  char ConfigFileName[MAXSTRINGSIZE];
+  map <std::string, TextMenu *> NametoTextMenuMap;
+
+  // populate all actions
+  MapOfActions::getInstance().populateActions();
 
   // build the main menu
   main_menu = new TextMenu(Log() << Verbose(0), "Main Menu");
 
-  moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,molecules,_1));
+  moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,World::getInstance().getMolecules(),_1));
   new DisplayMenuItem(main_menu,moleculeView,"Molecule List");
 
@@ -77,43 +68,52 @@
   new SeperatorItem(main_menu);
 
-  Action *setMoleculeAction = new MethodAction("setMoleculeAction",boost::bind(&MoleculeListClass::flipChosen,molecules));
+  Action *setMoleculeAction = new MethodAction("setMoleculeAction",boost::bind(&MoleculeListClass::flipChosen,World::getInstance().getMolecules()));
   new ActionMenuItem('a',"set molecule (in)active",main_menu,setMoleculeAction);
 
-  TextMenu *editMoleculesMenu = new TextMenu(Log() << Verbose(0), "Edit Molecules");
-  new SubMenuItem('e',"edit molecules (load, parse, save)",main_menu,editMoleculesMenu);
+  TextMenu *AnalysisMenu = new TextMenu(Log() << Verbose(0), "Analysis");
+  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("analysis", AnalysisMenu) );
+  new SubMenuItem('A',"Analysis (pair correlation, volume)",main_menu,AnalysisMenu);
 
-  Action *manipulateMoleculeAction = new MethodAction("manipulateMoleculeAction",boost::bind(&oldmenu::ManipulateMolecules,old_menu,periode, molecules, configuration));
-  new ActionMenuItem('g',"globally manipulate atoms in molecule",main_menu,manipulateMoleculeAction);
+  TextMenu *CommandMenu = new TextMenu(Log() << Verbose(0), "Configuration");
+  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("command", CommandMenu) );
+  new SubMenuItem('c',"configuration",main_menu,CommandMenu);
 
-  Action *mergeMoleculeAction = new MethodAction("mergeMoleculeAction",boost::bind(&oldmenu::MergeMolecules,old_menu,periode, molecules));
-  new ActionMenuItem('M',"Merge molecules",main_menu,mergeMoleculeAction);
+  TextMenu *AtomMenu = new TextMenu(Log() << Verbose(0), "Atoms");
+  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("atom", AtomMenu) );
+  new SubMenuItem('e',"edit atoms",main_menu,AtomMenu);
 
-  Action *manipulateAtomsAction = new MethodAction("manipulateAtomsAction",boost::bind(&oldmenu::ManipulateAtoms,old_menu,periode, molecules, configuration));
-  new ActionMenuItem('m',"manipulate atoms",main_menu,manipulateAtomsAction);
+  TextMenu *FragmentationMenu = new TextMenu(Log() << Verbose(0), "Fragmentation");
+  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("fragmentation", FragmentationMenu) );
+  new SubMenuItem('f',"fragmentation",main_menu,FragmentationMenu);
+
+  TextMenu *ParserMenu = new TextMenu(Log() << Verbose(0), "Parse files");
+  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("parser", ParserMenu) );
+  new SubMenuItem('p',"parse files into system",main_menu,ParserMenu);
+
+  TextMenu *MoleculesMenu = new TextMenu(Log() << Verbose(0), "Edit Molecules");
+  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("analysis", AnalysisMenu) );
+  new SubMenuItem('m',"edit molecules (load, parse, save)",main_menu,MoleculesMenu);
+
+  TextMenu *TesselationMenu = new TextMenu(Log() << Verbose(0), "Tesselate Molecules");
+  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("tesselation", TesselationMenu) );
+  new SubMenuItem('t',"tesselate molecules",main_menu,TesselationMenu);
+
+  TextMenu *WorldMenu = new TextMenu(Log() << Verbose(0), "World");
+  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("world", WorldMenu) );
+  new SubMenuItem('w',"edit world",main_menu,WorldMenu);
 
   new SeperatorItem(main_menu);
 
-  Action *editConfigAction = new MethodAction("editConfigAction",boost::bind(&config::Edit,configuration));
-  new ActionMenuItem('c',"edit the current configuration",main_menu,editConfigAction);
-
-  new SeperatorItem(main_menu);
-
-  Action *saveConfigAction = new MethodAction("saveConfigAction",boost::bind(&config::SaveAll,configuration, ConfigFileName, periode, molecules));
+  Action *saveConfigAction = new MethodAction("saveConfigAction",boost::bind(&config::SaveAll,World::getInstance().getConfig(), ConfigFileName, World::getInstance().getPeriode(), World::getInstance().getMolecules()));
   new ActionMenuItem('s',"save current setup to config file",main_menu,saveConfigAction);
-
-  Action *doTestAction = new MethodAction("doTestAction",boost::bind(&oldmenu::testroutine,old_menu,molecules));
-  new ActionMenuItem('T',"call the current test routine",main_menu,doTestAction);
 
   quitAction = new MethodAction("quitAction",boost::bind(&TextMenu::doQuit,main_menu),false);
   new ActionMenuItem('q',"quit",main_menu,quitAction);
 
-  // call all functions used to build the submenus
-
-  populateEditMoleculesMenu(editMoleculesMenu);
-
-  Action *returnFromEditMoleculeAction = new TextMenu::LeaveAction(editMoleculesMenu);
-  MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",editMoleculesMenu,returnFromEditMoleculeAction);
-
-  editMoleculesMenu->addDefault(returnItem);
+  // go through all menus and create them
+  for (map <std::string, TextMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner) {
+    cout << "Creating Menu " << MenuRunner->first << "." << endl;
+    populateMenu(MenuRunner->second, MenuRunner->first);
+  }
 
   // Add status indicators etc...
@@ -124,5 +124,4 @@
 TextWindow::~TextWindow()
 {
-  delete old_menu;
   delete quitAction;
   delete moleculeView;
@@ -135,27 +134,28 @@
 }
 
-void TextWindow::populateEditMoleculesMenu(Menu* editMoleculesMenu)
+char TextWindow::getSuitableShortForm(set <char> &ShortcutList, const std::string name) const
 {
-  MoleculeListClass *molecules = World::getInstance().getMolecules();
-  periodentafel *periode = World::getInstance().getPeriode();
+  for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {
+    if (ShortcutList.find(*CharRunner) == ShortcutList.end())
+      return *CharRunner;
+  }
+  DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for TextWindow::getSuitableShortForm()." << endl);
+  return ((char)(ShortcutList.size() % 10) + '0');
+}
 
-  // build the EditMoleculesMenu
-  Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode));
-  new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction);
-
-  Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode));
-  new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction);
-
-  Action *changeFilenameAction = new MoleculeChangeNameAction();
-  new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction);
-
-  Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules));
-  new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction);
-
-  Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules));
-  new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction);
-
-  Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules));
-  new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction);
-
+void TextWindow::populateMenu(TextMenu* Menu, const  std::string &MenuName)
+{
+  Action *ActionItem = NULL;
+  set <char> ShortcutList;
+  // through all actions for this menu
+  pair < multimap <std::string, std::string>::iterator, multimap <std::string, std::string>::iterator > MenuActions = MapOfActions::getInstance().MenuContainsActionMap.equal_range(MenuName);
+  for (multimap <std::string, std::string>::const_iterator MenuRunner = MenuActions.first; MenuRunner != MenuActions.second; ++MenuRunner) {
+    cout << " Adding " << MenuRunner->second << " to submenu " << MenuName << endl;
+    ActionItem = ActionRegistry::getInstance().getActionByName(MenuRunner->second);
+    new ActionMenuItem(getSuitableShortForm(ShortcutList, MenuRunner->second),MapOfActions::getInstance().getDescription(MenuRunner->second).c_str(),Menu,ActionItem);
+  }
+  // finally add default quit item
+  Action *returnFromAction = new TextMenu::LeaveAction(Menu);
+  MenuItem *returnFromItem = new ActionMenuItem('q',"return to Main menu",Menu,returnFromAction);
+  Menu->addDefault(returnFromItem);
 }
Index: src/UIElements/TextUI/TextWindow.hpp
===================================================================
--- src/UIElements/TextUI/TextWindow.hpp	(revision b800215c062e714dbeab7570ef2a6df003c54c1c)
+++ src/UIElements/TextUI/TextWindow.hpp	(revision b0acc3a7b5b3ca40d4aa3940fd46ba4055624f89)
@@ -11,7 +11,8 @@
 #include "MainWindow.hpp"
 
+#include <set>
+
 class TextMenu;
 class Action;
-class oldmenu;
 class StringView;
 class TextStatusIndicator;
@@ -27,5 +28,6 @@
 private:
   // populaters
-  void populateEditMoleculesMenu(Menu* editMoleculesMenu);
+  char getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const;
+  void populateMenu(TextMenu* Menu, const std::string &name);
 
   TextMenu *main_menu;
@@ -36,7 +38,4 @@
   StringView *moleculeView;
   TextStatusIndicator *statusIndicator;
-
-  // This class still contains a lot of scattered functionality
-  oldmenu *old_menu;
 };
 
