Index: configure.ac
===================================================================
--- configure.ac	(revision 943d02e40086a937085f077abff25299a61b3c66)
+++ configure.ac	(revision d3a46dd9779aed0b0c746d4835159414fe9963b7)
@@ -16,8 +16,4 @@
 
 
-AC_FUNC_MALLOC
-AC_FUNC_REALLOC
-AC_CHECK_FUNCS([floor pow sqrt strchr])
-
 # Checks for libraries.
 AC_CHECK_LIB(m, sqrt, ,AC_MSG_ERROR([compatible libc math library not found]))
@@ -27,4 +23,8 @@
 AC_CHECK_HEADERS([sys/time.h])
 AC_HEADER_STDBOOL
+
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_CHECK_FUNCS([floor pow sqrt strchr])
 
 # Checks for typedefs, structures, and compiler characteristics.
@@ -41,9 +41,33 @@
 
 # debugging info
-AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Output debugging information (default is no)]),
-              [enable_debug=$enableval], [enable_debug=maybe])
-if test x"$enable_debug" = xyes; then
+AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Output debugging information, argument is yes or debugging level (default is no).]),
+              [enable_debug=$enableval], [enable_debug=no])
+if ! test x"$enable_debug" = xno; then
+	if test x"${enable_debug}" = xyes; then
+		CFLAGS="-g3"
+		CXXFLAGS="-g3"
+	else
+		CFLAGS="-g${enable_debug}"
+		CXXFLAGS="-g${enable_debug}"
+	fi
   AC_DEFINE(HAVE_DEBUG,1, ["Output debugging info"])
   AC_SUBST(HAVE_DEBUG)
+fi
+
+# optimization level
+AC_ARG_ENABLE([optimization],AS_HELP_STRING([--enable-optimization],[Optimization level of compiler. Argument is yes or debugging level. (default is 2)]),
+              [enable_optimization=$enableval], [enable_optimization=yes])
+if test ! x"$enable_optimization" = xno; then
+	if test x"$enable_debug" = xno; then
+		if test x"${enable_optimization}" = xyes; then
+			CFLAGS="-O2"
+			CXXFLAGS="-O2"
+		else
+			CFLAGS="-O${enable_optimization}"
+			CXXFLAGS="-O${enable_optimization}"
+		fi
+	else
+		AC_MSG_WARN(["Already specified --enable-debug!"])
+	fi
 fi
 
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 943d02e40086a937085f077abff25299a61b3c66)
+++ src/Makefile.am	(revision d3a46dd9779aed0b0c746d4835159414fe9963b7)
@@ -8,8 +8,7 @@
 joiner_SOURCES = joiner.cpp parser.cpp helpers.cpp verbose.cpp helpers.hpp parser.hpp
 analyzer_SOURCES = analyzer.cpp parser.cpp datacreator.cpp helpers.cpp verbose.cpp helpers.hpp parser.hpp datacreator.hpp 
-#molecuilder_CXXFLAGS = -cc=/opt/packages/gcc-4.0.2/bin/gcc  -g -O -march=nocona -Wall -DBIGENDIAN=0
-molecuilder_CXXFLAGS = -g3 -march=nocona -Wall -DBIGENDIAN=0
-joiner_CXXFLAGS = -g3 -march=nocona -Wall -DBIGENDIAN=0
-analyzer_CXXFLAGS = -g3 -march=nocona -Wall -DBIGENDIAN=0
+molecuilder_CXXFLAGS = -march=nocona -Wall -DBIGENDIAN=0
+joiner_CXXFLAGS = -march=nocona -Wall -DBIGENDIAN=0
+analyzer_CXXFLAGS = -march=nocona -Wall -DBIGENDIAN=0
 
 #EXTRA_DIST = ${molecuilder_DATA}
Index: src/helpers.cpp
===================================================================
--- src/helpers.cpp	(revision 943d02e40086a937085f077abff25299a61b3c66)
+++ src/helpers.cpp	(revision d3a46dd9779aed0b0c746d4835159414fe9963b7)
@@ -23,4 +23,15 @@
 };
 
+/** Output of a debug message to stderr.
+ * \param *P Problem at hand, points to ParallelSimulationData#me
+ * \param output output string
+ */
+#ifdef HAVE_DEBUG
+void debug_in(const char *output, const char *file, const int line) {
+  if (output) fprintf(stderr,"DEBUG: in %s at line %i: %s\n", file, line, output);
+}
+#else
+void debug_in(const char *output, const char *file, const int line) {}  // print nothing
+#endif
 
 /** Wrapper for allocating'ing a memory range with *output if it fails.
Index: src/helpers.hpp
===================================================================
--- src/helpers.hpp	(revision 943d02e40086a937085f077abff25299a61b3c66)
+++ src/helpers.hpp	(revision d3a46dd9779aed0b0c746d4835159414fe9963b7)
@@ -22,4 +22,23 @@
 
 /********************************************** helpful functions *********************************/
+
+// taken out of TREMOLO
+/*@-namechecks@*/
+#ifndef __GNUC__
+# undef __attribute__
+# define __attribute__(x)
+#endif
+/*@=namechecks@*/
+
+/* Behandelt aufgetretene Fehler. error ist der Fehlertyp(enum Errors)
+   void *SpecialData ist ein untypisierter Zeiger auf Spezielle Daten zur Fehlerbehandlung.
+   Man koennte auch noch einen Zeiger auf eine Funktion uebergeben */
+extern void /*@exits@*/ debug(const char *output);
+  //__attribute__ ((__return__));
+#define debug(data) debug_in((data), __FILE__, __LINE__)
+
+extern void /*@exits@*/ debug_in(const char *output,
+    const char *file, const int line);
+  //__attribute__ ((__return__));
 
 double ask_value(const char *text);
Index: src/molecules.cpp
===================================================================
--- src/molecules.cpp	(revision 943d02e40086a937085f077abff25299a61b3c66)
+++ src/molecules.cpp	(revision d3a46dd9779aed0b0c746d4835159414fe9963b7)
@@ -1871,4 +1871,12 @@
   MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
 
+#ifdef ADDHYDROGEN
+  debug("Test");
+  cout << Verbose(0) << "I will treat hydrogen special and saturate dangling bonds with it." << endl;
+#else
+  debug("Test2");
+  cout << Verbose(0) << "Hydrogen is treated just like the rest of the lot." << endl;
+#endif
+  
   CreateListOfBondsPerAtom(out);
 
