Index: src/UIElements/MainWindow.hpp
===================================================================
--- src/UIElements/MainWindow.hpp	(revision cc04b7dcf53d227c2347afab510d4041e1140de4)
+++ src/UIElements/MainWindow.hpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
@@ -13,4 +13,6 @@
 class periodentafel;
 
+class Menu;
+
 class MainWindow
 {
@@ -19,7 +21,13 @@
   virtual ~MainWindow();
 
-  virtual void display(MoleculeListClass *, config *, periodentafel *, char *)=0;
+  virtual void display()=0;
 
 };
 
+typedef void (*MenuMaker)(Menu*,MoleculeListClass*, config*, periodentafel*);
+
+struct menuPopulaters{
+  MenuMaker MakeEditMoleculesMenu;
+};
+
 #endif /* MAINWINDOW_HPP_ */
Index: src/UIElements/TextUIFactory.cpp
===================================================================
--- src/UIElements/TextUIFactory.cpp	(revision cc04b7dcf53d227c2347afab510d4041e1140de4)
+++ src/UIElements/TextUIFactory.cpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
@@ -27,6 +27,6 @@
 }
 
-MainWindow* TextUIFactory::makeMainWindow() {
-  return new TextWindow();
+MainWindow* TextUIFactory::makeMainWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName) {
+  return new TextWindow(populaters,molecules,configuration,periode,ConfigFileName);
 }
 
Index: src/UIElements/TextUIFactory.hpp
===================================================================
--- src/UIElements/TextUIFactory.hpp	(revision cc04b7dcf53d227c2347afab510d4041e1140de4)
+++ src/UIElements/TextUIFactory.hpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
@@ -19,5 +19,5 @@
 
   virtual Dialog* makeDialog();
-  virtual MainWindow* makeMainWindow();
+  virtual MainWindow* makeMainWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *);
 
 protected:
Index: src/UIElements/TextWindow.cpp
===================================================================
--- src/UIElements/TextWindow.cpp	(revision cc04b7dcf53d227c2347afab510d4041e1140de4)
+++ src/UIElements/TextWindow.cpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
@@ -7,5 +7,37 @@
 
 #include "UIElements/TextWindow.hpp"
+
+#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 "memoryusageobserverunittest.hpp"
+#include "molecule.hpp"
+#include "periodentafel.hpp"
+
 #include "../menu.hpp"
+
+#include "Menu/Menu.hpp"
+#include "Menu/TextMenu.hpp"
+#include "Menu/ActionMenuItem.hpp"
+#include "Menu/SeperatorItem.hpp"
+#include "Menu/DisplayMenuItem.hpp"
+#include "Menu/SubMenuItem.hpp"
+#include "Actions/MethodAction.hpp"
+#include "Actions/ErrorAction.hpp"
+#include "Views/StreamStringView.hpp"
+#include "Views/MethodStringView.hpp"
 
 #include <iostream>
@@ -13,20 +45,68 @@
 using namespace std;
 
-TextWindow::TextWindow()
+// TODO: see what code can be moved to a base class for Graphic and Text Windows
+TextWindow::TextWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName)
 {
-  // TODO Auto-generated constructor stub
+  old_menu = new oldmenu;
 
+  // build the main menu
+  main_menu = new TextMenu(Log() << Verbose(0), "Main Menu");
+
+  moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,molecules,_1));
+  new DisplayMenuItem(main_menu,moleculeView,"Molecule List");
+
+  new SeperatorItem(main_menu);
+
+  Action *setMoleculeAction = new MethodAction("setMoleculeAction",boost::bind(&MoleculeListClass::flipChosen,molecules));
+  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);
+
+  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);
+
+  Action *mergeMoleculeAction = new MethodAction("mergeMoleculeAction",boost::bind(&oldmenu::MergeMolecules,old_menu,periode, molecules));
+  new ActionMenuItem('M',"Merge molecules",main_menu,mergeMoleculeAction);
+
+  Action *manipulateAtomsAction = new MethodAction("manipulateAtomsAction",boost::bind(&oldmenu::ManipulateAtoms,old_menu,periode, molecules, configuration));
+  new ActionMenuItem('m',"manipulate atoms",main_menu,manipulateAtomsAction);
+
+  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));
+  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
+
+  populaters.MakeEditMoleculesMenu(editMoleculesMenu,molecules,configuration,periode);
+
+  returnFromEditMoleculeAction = new MethodAction("returnAction",boost::bind(&TextMenu::doQuit,editMoleculesMenu),false);
+  MenuItem *returnItem = new ActionMenuItem('q',"return to Main menu",editMoleculesMenu,returnFromEditMoleculeAction);
+
+  editMoleculesMenu->addDefault(returnItem);
 }
 
 TextWindow::~TextWindow()
 {
-  // TODO Auto-generated destructor stub
+  delete old_menu;
+  delete quitAction;
+  delete returnFromEditMoleculeAction;
+  delete moleculeView;
+  delete main_menu;
 }
 
-void TextWindow::display(MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName) {
-  cout << "creating main window" <<endl;
-  oldmenu *main_menu;
-  main_menu = new oldmenu;
-  main_menu->perform(molecules, configuration, periode, ConfigFileName);
-  delete main_menu;
+void TextWindow::display() {
+  main_menu->display();
 }
Index: src/UIElements/TextWindow.hpp
===================================================================
--- src/UIElements/TextWindow.hpp	(revision cc04b7dcf53d227c2347afab510d4041e1140de4)
+++ src/UIElements/TextWindow.hpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
@@ -11,11 +11,27 @@
 #include "UIElements/MainWindow.hpp"
 
+class TextMenu;
+class Action;
+class oldmenu;
+class StringView;
+
 class TextWindow : public MainWindow
 {
 public:
-  TextWindow();
+  TextWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *);
   virtual ~TextWindow();
 
-  virtual void display(MoleculeListClass *, config *, periodentafel *, char *);
+  virtual void display();
+private:
+  TextMenu *main_menu;
+
+  // some actions only needed in textMenus
+  Action *quitAction;
+  Action *returnFromEditMoleculeAction;
+  // all views that are contained in the main Menu
+  StringView *moleculeView;
+
+  // This class still contains a lot of scattered functionality
+  oldmenu *old_menu;
 };
 
Index: src/UIElements/UIFactory.hpp
===================================================================
--- src/UIElements/UIFactory.hpp	(revision cc04b7dcf53d227c2347afab510d4041e1140de4)
+++ src/UIElements/UIFactory.hpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
@@ -12,4 +12,10 @@
 class Dialog;
 
+class MoleculeListClass;
+class config;
+class periodentafel;
+
+struct menuPopulaters;
+
 class UIFactory
 {
@@ -20,5 +26,5 @@
 
   // methods for creating UIElements
-  virtual MainWindow* makeMainWindow()=0;
+  virtual MainWindow* makeMainWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *)=0;
   virtual Dialog* makeDialog()=0;
 
