Index: src/UIElements/Dialog.cpp
===================================================================
--- src/UIElements/Dialog.cpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
+++ src/UIElements/Dialog.cpp	(revision 45f5d6c9765964e165f92356c6f5d155ec541135)
@@ -14,45 +14,64 @@
 Dialog::Dialog()
 {
-  // TODO Auto-generated constructor stub
-
 }
 
 Dialog::~Dialog()
 {
-  // TODO Auto-generated destructor stub
+  list<Query*>::iterator iter;
+  for(iter=queries.begin();iter!=queries.end();iter++){
+    delete (*iter);
+  }
 }
 
-void Dialog::queryInt(const char *_title, int *_target) {
-  Query q;
-  q.title = _title;
-  q.type = Int;
-  q.target = (void*) _target;
-
-  queries.push_back(q);
+void Dialog::registerQuery(Query *query){
+  queries.push_back(query);
 }
 
-void Dialog::queryString(const char *_title, string *_target) {
-    Query q;
-    q.title = _title;
-    q.type = String;
-    q.target = (void*) _target;
-
-    queries.push_back(q);
+bool Dialog::display(){
+  list<Query*>::iterator iter;
+  bool retval = true;
+  for(iter=queries.begin(); iter!=queries.end(); iter++){
+    retval &= (*iter)->handle();
+    // if any query fails (is canceled), we can end the handling process
+    if(!retval)
+      break;
+  }
+  if (retval){
+    // if all queries succeeded we can set the targets to appropriate values
+    for(iter=queries.begin(); iter!=queries.end(); iter++) {
+      (*iter)->setResult();
+    }
+  }
+  return retval;
 }
 
-void Dialog::display(){
-  list<Query>::iterator iter;
-  for(iter=queries.begin(); iter!=queries.end(); iter++){
-    switch((*iter).type) {
-      case Int:
-        handleInt((*iter).title,(int*)((*iter).target));
-        break;
-      case String:
-        handleString((*iter).title,(string*)((*iter).target));
-        break;
-      default:
-        assert(0 && "This type of query does not seem to exist... Something is seriously wrong");
-        break;
-    }
-  }
+Dialog::Query::Query(string _title) :
+    title(_title)
+{}
+
+Dialog::Query::~Query() {}
+
+const std::string Dialog::Query::getTitle() const{
+  return title;
 }
+
+Dialog::IntQuery::IntQuery(string title,int *_target) :
+    Query(title), target(_target)
+{}
+
+Dialog::IntQuery::~IntQuery() {}
+
+void Dialog::IntQuery::setResult() {
+  *target = tmp;
+}
+
+Dialog::StringQuery::StringQuery(string title,string *_target) :
+    Query(title), target(_target)
+{}
+
+Dialog::StringQuery::~StringQuery() {};
+
+void Dialog::StringQuery::setResult() {
+  *target = tmp;
+}
+
Index: src/UIElements/Dialog.hpp
===================================================================
--- src/UIElements/Dialog.hpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
+++ src/UIElements/Dialog.hpp	(revision 45f5d6c9765964e165f92356c6f5d155ec541135)
@@ -12,4 +12,7 @@
 #include<list>
 
+class MoleculeListClass;
+class Molecule;
+
 class Dialog
 {
@@ -18,27 +21,63 @@
   virtual ~Dialog();
 
-  void queryInt(const char *, int *);
-  void queryString(const char*, std::string *);
+  virtual void queryInt(const char *, int *)=0;
+  virtual void queryString(const char*, std::string *)=0;
+ // virtual void queryMolecule(const char*,MoleculeListClass*,Molecule*)=0;
 
-  virtual void display();
+  virtual bool display();
 
 protected:
-  virtual void handleInt(std::string,int *)=0;
-  virtual void handleString(std::string,std::string *)=0;
-
-
-private:
   // methodology for handling queries
   // all queries are stored and then performed at appropriate times
 
   //these queries can be handled by this dialog
-  enum QueryType {Int,String};
-  struct Query {
+
+  //TODO: Find a way to reduce complexity...
+  //needs O(N*M) query classes, where N is the number of query types and M is the number of GUIs
+  //usual approach for reducing inheritance complexity (strategy pattern) does not work,
+  //due to lack of common code for query types as well as GUI-Types (all subtypes differ a lot)
+
+  //base class for all queries
+  class Query {
+  public:
+    Query(std::string _title);
+    ~Query();
+    virtual bool handle()=0;
+    virtual void setResult()=0;
+  protected:
+    const std::string getTitle() const;
+  private:
     std::string title;
-    QueryType type;
-    void *target;
   };
 
-  std::list<Query> queries;
+  //Specialized classes for certain types. GUI-Types are not specialized at this time
+  class IntQuery : public Query {
+  public:
+    IntQuery(std::string title,int *_target);
+    ~IntQuery();
+    virtual bool handle()=0;
+    virtual void setResult();
+  protected:
+    int tmp;
+  private:
+    int *target;
+  };
+
+  class StringQuery : public Query {
+  public:
+    StringQuery(std::string title,std::string *_target);
+    ~StringQuery();
+    virtual bool handle()=0;
+    virtual void setResult();
+  protected:
+    std::string tmp;
+  private:
+    std::string *target;
+  };
+
+void registerQuery(Query* query);
+
+private:
+  std::list<Query*> queries;
 
 };
Index: src/UIElements/TextDialog.cpp
===================================================================
--- src/UIElements/TextDialog.cpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
+++ src/UIElements/TextDialog.cpp	(revision 45f5d6c9765964e165f92356c6f5d155ec541135)
@@ -17,21 +17,39 @@
 TextDialog::TextDialog()
 {
-  // TODO Auto-generated constructor stub
-
 }
 
 TextDialog::~TextDialog()
 {
-  // TODO Auto-generated destructor stub
 }
 
-void TextDialog::handleInt(std::string title, int *target) {
-  Log() << Verbose(0) << title;
-  cin >> (*target);
+void TextDialog::queryInt(const char* title, int* target){
+  registerQuery(new IntTextQuery(title,target));
 }
 
-void TextDialog::handleString(std::string title, string *target) {
-  string input;
-  Log() << Verbose(0) << title;
-  cin >> (*target);
+void TextDialog::queryString(const char* title, string* target){
+  registerQuery(new StringTextQuery(title,target));
 }
+
+TextDialog::IntTextQuery::IntTextQuery(string title,int *_target) :
+    Dialog::IntQuery(title,_target)
+{}
+
+TextDialog::IntTextQuery::~IntTextQuery() {}
+
+bool TextDialog::IntTextQuery::handle() {
+  Log() << Verbose(0) << IntQuery::getTitle();
+  cin >> tmp;
+  return true;
+}
+
+TextDialog::StringTextQuery::StringTextQuery(string title,string *_target) :
+    Dialog::StringQuery(title,_target)
+{}
+
+TextDialog::StringTextQuery::~StringTextQuery() {}
+
+bool TextDialog::StringTextQuery::handle() {
+  Log() << Verbose(0) << StringQuery::getTitle();
+  cin >> tmp;
+  return true;
+}
Index: src/UIElements/TextDialog.hpp
===================================================================
--- src/UIElements/TextDialog.hpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
+++ src/UIElements/TextDialog.hpp	(revision 45f5d6c9765964e165f92356c6f5d155ec541135)
@@ -9,4 +9,6 @@
 #define TEXTDIALOG_HPP_
 
+#include <string>
+
 #include "UIElements/Dialog.hpp"
 
@@ -17,6 +19,22 @@
   virtual ~TextDialog();
 
-  virtual void handleInt(std::string,int *);
-  virtual void handleString(std::string,std::string *);
+  virtual void queryInt(const char *, int *);
+  virtual void queryString(const char*, std::string *);
+
+protected:
+  // specialized stuff for text queries
+  class IntTextQuery : public Dialog::IntQuery {
+  public:
+    IntTextQuery(std::string title, int *_target);
+    ~IntTextQuery();
+    virtual bool handle();
+  };
+
+  class StringTextQuery : public Dialog::StringQuery {
+  public:
+    StringTextQuery(std::string title, std::string *_target);
+    ~StringTextQuery();
+    virtual bool handle();
+  };
 };
 
Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision aab2b1b96129d975cf20e4bb5913abf3b610eda7)
+++ src/builder.cpp	(revision 45f5d6c9765964e165f92356c6f5d155ec541135)
@@ -69,4 +69,5 @@
 #include "UIElements/UIFactory.hpp"
 #include "UIElements/MainWindow.hpp"
+#include "UIElements/Dialog.hpp"
 #include "Menu/ActionMenuItem.hpp"
 #include "Actions/ActionRegistry.hpp"
