diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e9f94076dd42ed509c354097b04cc12bfc187ba..162150afa23ba671579b0c2e03d90719ba988c85 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,10 +2,16 @@ cmake_minimum_required (VERSION 3.4.3)
 
 set (CMAKE_CXX_STANDARD 14)
 
-project (CORSIKA VERSION 8.0.0.0 DESCRIPTION "CORSIKA C++ project")
+project (corsika VERSION 8.0.0 DESCRIPTION "CORSIKA C++ project")
+
+#add_custom_target (corsika_pre_build)
+#add_custom_command (TARGET corsika_pre_build PRE_BUILD COMMAND "${PROJECT_SOURCE_DIR}/pre_compile.py")
 
 find_package (Boost 1.40 COMPONENTS program_options REQUIRED)
 find_package (Eigen3 3.3 REQUIRED)
 
+add_subdirectory (Documentation)
 add_subdirectory (Framework)
+#add_subdirectory (Processes)
 add_subdirectory (Main)
+
diff --git a/Documentation/CMakeLists.txt b/Documentation/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..194c7be44d8640fd17a3d76b67c00801ddf41e90
--- /dev/null
+++ b/Documentation/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+add_subdirectory (Doxygen)
+add_subdirectory (Examples)
+
diff --git a/Documentation/Doxygen/CMakeLists.txt b/Documentation/Doxygen/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..c045db8fd696f3bffd8cccb2ceddeef4ce7063ce
--- /dev/null
+++ b/Documentation/Doxygen/CMakeLists.txt
@@ -0,0 +1,26 @@
+
+find_package (Doxygen REQUIRED dot OPTIONAL_COMPONENTS mscgen dia)
+
+if (DOXYGEN_FOUND)
+  set (DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
+  set (DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
+  set (DOXYGEN_GENERATE_HTML YES)
+  set (DOXYGEN_GENERATE_MAN YES)
+  configure_file (${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
+  message ("Start doxygen with \"make doxygen\"")
+  
+  # note the option ALL which allows to build the docs together with the application
+  add_custom_target (doxygen # ALL
+    COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    COMMENT "Generating API documentation with Doxygen"
+    VERBATIM)
+
+  install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc OPTIONAL)
+         
+else (DOXYGEN_FOUND)
+  
+  message ("Doxygen need to be installed to generate the doxygen documentation")
+  
+endif (DOXYGEN_FOUND)
+
diff --git a/Documentation/Doxygen/Doxyfile.in b/Documentation/Doxygen/Doxyfile.in
new file mode 100644
index 0000000000000000000000000000000000000000..400b6f2e0877f77709a7fdacbf9ba8ff370e6124
--- /dev/null
+++ b/Documentation/Doxygen/Doxyfile.in
@@ -0,0 +1,25 @@
+PROJECT_NAME           = CORSIKA8
+
+OUTPUT_DIRECTORY       = @CMAKE_CURRENT_BINARY_DIR@/
+INPUT                  = @CMAKE_CURRENT_SOURCE_DIR@/../.. 
+
+GENERATE_HTML          = YES
+GENERATE_LATEX         = NO
+
+FILE_PATTERNS          = *.cc *.h
+RECURSIVE              = YES
+
+SOURCE_BROWSER         = YES
+# INLINE_SOURCES
+
+CLASS_DIAGRAMS         = YES
+HAVE_DOT               = YES
+CLASS_GRAPH            = YES
+UML_LOOK               = YES
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+GENERATE_LEGEND        = YES
+
+SEARCHENGINE           = YES
diff --git a/Documentation/Examples/CMakeLists.txt b/Documentation/Examples/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7045e5e048ec9d41feac2a98acbad00872bff606
--- /dev/null
+++ b/Documentation/Examples/CMakeLists.txt
@@ -0,0 +1,10 @@
+
+
+add_executable (geometry_example geometry_example.cc)
+target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits)
+install (TARGETS geometry_example DESTINATION share/examples)
+
+
+add_executable (logger_example logger_example.cc)
+target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
+install (TARGETS logger_example DESTINATION share/examples)
diff --git a/Main/geometry_example.cc b/Documentation/Examples/geometry_example.cc
similarity index 76%
rename from Main/geometry_example.cc
rename to Documentation/Examples/geometry_example.cc
index f0bd11f8715180708aea83a572f87b73d97d49e2..d045decba8867bb84d2999673d1da3fe2615f83d 100644
--- a/Main/geometry_example.cc
+++ b/Documentation/Examples/geometry_example.cc
@@ -28,14 +28,14 @@ int main()
     auto const diff = p2 - p1;
     auto const norm = diff.squaredNorm();
     
-    std::cout << diff.getComponents() << std::endl;
-    std::cout << norm << std::endl;
+    std::cout << "p2-p1 components: " << diff.getComponents() << std::endl;
+    std::cout << "p2-p1 norm^2: " << norm << std::endl;
     
     Sphere s(p1, 10_m);
-    std::cout << s.isInside(p2) << std::endl;    
+    std::cout << "p1 inside s:  " << s.isInside(p2) << std::endl;    
     
     Sphere s2(p1, 3_um);
-    std::cout << s2.isInside(p2) << std::endl;    
+    std::cout << "p1 inside s2: " << s2.isInside(p2) << std::endl;    
     
     return EXIT_SUCCESS;
 }
diff --git a/Main/logger_example.cc b/Documentation/Examples/logger_example.cc
similarity index 95%
rename from Main/logger_example.cc
rename to Documentation/Examples/logger_example.cc
index 622c68e4aaf4a452a8b19ba75a9b1dba2662bb11..5455f7d5ea6295d7ec5cfcf118942db5ec71800d 100644
--- a/Main/logger_example.cc
+++ b/Documentation/Examples/logger_example.cc
@@ -11,6 +11,7 @@ int
 main()
 {
   {
+    cout << "writing to \"another.log\"" << endl;
     ofstream logfile("another.log");
     typedef Sink<ofstream, StdBuffer> SinkFile;
     SinkFile sink(logfile, StdBuffer(10000));
diff --git a/Main/CMakeLists.txt b/Main/CMakeLists.txt
index 8698a20e4e4cbd59a6310c781fbf66224f0ede42..139597f9cb07c5d48bed18984ec4747f4b4f3438 100644
--- a/Main/CMakeLists.txt
+++ b/Main/CMakeLists.txt
@@ -1,10 +1,2 @@
 
 
-add_executable (geometry_example geometry_example.cc)
-target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits)
-install (TARGETS geometry_example DESTINATION bin)
-
-
-add_executable (logger_example logger_example.cc)
-target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
-install (TARGETS logger_example DESTINATION bin)
diff --git a/Processes/CMakeLists.txt b/Processes/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f1e2ce31a5222add07914f66e1f8b9d5b48be415
--- /dev/null
+++ b/Processes/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory (NullModel)