diff --git a/.cproject b/.cproject
index 98b416ee0f81957e5d5a634ca3135f0d9f213bd0..739e0c0840b1f011badcf81777a9a1e75d4b7af4 100644
--- a/.cproject
+++ b/.cproject
@@ -20,7 +20,7 @@
 					<folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.45089428.834509647" name="/" resourcePath="">
 						<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.329208693" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base">
 							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.macosx.base.35496915" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/>
-							<builder arguments="" buildPath="${workspace_loc:/BornAgain}" cleanBuildTarget="distclean" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.1780058782" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
+							<builder arguments="-C ../BornAgain_cmake_release" buildPath="" cleanBuildTarget="clean" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.1780058782" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
 							<tool id="cdt.managedbuild.tool.macosx.c.linker.macosx.base.2076947871" name="MacOS X C Linker" superClass="cdt.managedbuild.tool.macosx.c.linker.macosx.base"/>
 							<tool id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base.2050732830" name="MacOS X C++ Linker" superClass="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base">
 								<option id="macosx.cpp.link.option.paths.102310300" name="Library search path (-L)" superClass="macosx.cpp.link.option.paths"/>
@@ -90,7 +90,7 @@
 					<folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.45089428.1343516600." name="/" resourcePath="">
 						<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.443634681" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base">
 							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.macosx.base.966869129" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/>
-							<builder arguments="-j3" buildPath="${workspace_loc:/BornAgain}" cleanBuildTarget="distclean" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.957115956" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.macosx.base">
+							<builder arguments="-C ../BornAgain_cmake_debug VERBOSE=1" buildPath="" cleanBuildTarget="clean" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.957115956" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.macosx.base">
 								<outputEntries>
 									<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name=""/>
 								</outputEntries>
@@ -153,11 +153,9 @@
 		<configuration configurationName="Default">
 			<resource resourceType="PROJECT" workspacePath="/BornAgain"/>
 		</configuration>
-		<configuration configurationName="Debug">
-			<resource resourceType="PROJECT" workspacePath="/BornAgain"/>
-		</configuration>
+		<configuration configurationName="Release"/>
+		<configuration configurationName="Debug"/>
 	</storageModule>
-	<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
 	<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
 	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
 	<storageModule moduleId="scannerConfiguration">
@@ -175,4 +173,24 @@
 			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
 		</scannerConfigBuildInfo>
 	</storageModule>
+	<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
+		<buildTargets>
+			<target name="CMake Release" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+				<buildCommand>cmake</buildCommand>
+				<buildArguments>-E chdir ../BornAgain_cmake_release/ cmake -G "Unix Makefiles" ../BornAgain/ -DCMAKE_BUILD_TYPE=Release</buildArguments>
+				<buildTarget/>
+				<stopOnError>true</stopOnError>
+				<useDefaultCommand>false</useDefaultCommand>
+				<runAllBuilders>true</runAllBuilders>
+			</target>
+			<target name="CMake Debug" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
+				<buildCommand>cmake</buildCommand>
+				<buildArguments>-E chdir ../BornAgain_cmake_debug/ cmake -G "Unix Makefiles" ../BornAgain/ -DCMAKE_BUILD_TYPE=Debug</buildArguments>
+				<buildTarget/>
+				<stopOnError>true</stopOnError>
+				<useDefaultCommand>false</useDefaultCommand>
+				<runAllBuilders>true</runAllBuilders>
+			</target>
+		</buildTargets>
+	</storageModule>
 </cproject>
diff --git a/.project b/.project
index 4243e7d63751c49c603d67ecde573a0dd666e08c..2e98a58e2bcd5924e3b1ea0ea466027b6c229ab8 100644
--- a/.project
+++ b/.project
@@ -82,7 +82,7 @@
 	</natures>
 	<filteredResources>
 		<filter>
-			<id>1347614538348</id>
+			<id>1379602173960</id>
 			<name></name>
 			<type>21</type>
 			<matcher>
@@ -104,6 +104,14 @@
 						<id>org.eclipse.ui.ide.multiFilter</id>
 						<arguments>1.0-name-matches-false-false-*.pri</arguments>
 					</matcher>
+					<matcher>
+						<id>org.eclipse.ui.ide.multiFilter</id>
+						<arguments>1.0-name-matches-false-false-CMakeLists.txt</arguments>
+					</matcher>
+					<matcher>
+						<id>org.eclipse.ui.ide.multiFilter</id>
+						<arguments>1.0-name-matches-false-false-*.cmake</arguments>
+					</matcher>
 				</arguments>
 			</matcher>
 		</filter>
diff --git a/App/inc/IsGISAXSTools.h b/App/inc/IsGISAXSTools.h
index 6831eaf7611562fc0bdc6ed23efb8d01f5a66108..cd30e4323246825828e581f662f4b220bbe0b8aa 100644
--- a/App/inc/IsGISAXSTools.h
+++ b/App/inc/IsGISAXSTools.h
@@ -157,7 +157,7 @@ public:
     static void drawOutputDataComparisonResults(
         const OutputData<double>& data,
         const OutputData<double>& reference,
-        const std::string& name=std::string("noname"),
+        const std::string& name=std::string("no name"),
         const std::string& title=std::string("no title"),
         double hmin=1.,
         double hmax = -1.,
diff --git a/App/src/TestPolarizedMeso.cpp b/App/src/TestPolarizedMeso.cpp
index a295dadd4f1978c8e8cb7a0b800f20f8c4188b7d..f5480caaa2d1e78ab655bd091a3196a5458e66f6 100644
--- a/App/src/TestPolarizedMeso.cpp
+++ b/App/src/TestPolarizedMeso.cpp
@@ -25,9 +25,9 @@
 
 TestPolarizedMeso::TestPolarizedMeso()
 : mp_sample(0)
-, m_meso_width(3e+3*Units::nanometer)
+, m_meso_width(2e+3*Units::nanometer)
 , m_surface_filling_ratio(0.03)
-, m_meso_size_steps(1e+3*Units::nanometer)
+, m_meso_size_steps(500.0*Units::nanometer)
 //, m_sigma_meso_height(10*Units::nanometer)
 //, m_sigma_meso_radius(10*Units::nanometer)
 , m_lattice_length_a(13.5*Units::nanometer)
@@ -55,11 +55,11 @@ void TestPolarizedMeso::execute()
     // calculate scattered intensity from sample
     Simulation simulation(mp_options);
     simulation.setDetectorParameters(
-        100, 0.0*Units::degree, 2.0*Units::degree, 100,
-        0.0*Units::degree, 2.0*Units::degree);
+        100, -1.0*Units::degree, 6.5*Units::degree, 100,
+        -1.0*Units::degree, 6.5*Units::degree);
     simulation.setBeamParameters(
-        1.0*Units::angstrom, 0.2*Units::degree, 0.0*Units::degree);
-    simulation.setBeamIntensity(1e8);
+        6.0*Units::angstrom, 0.25*Units::degree, 0.0*Units::degree);
+    simulation.setBeamIntensity(1e11);
 
     // Run simulation
     simulation.setSample(*mp_sample);
@@ -108,7 +108,7 @@ MultiLayer* TestPolarizedMeso::createSample() const
         new InterferenceFunctionNone();
     ParticleDecoration particle_decoration;
     size_t n_max_phi_rotation_steps = 11;
-    size_t n_sizes = 4;
+    size_t n_sizes = 6;
 
     double phi_step = M_PI/4.0/n_max_phi_rotation_steps;
     double phi_start = 0.0;
@@ -149,7 +149,7 @@ MesoCrystal* TestPolarizedMeso::createMeso(double a, double c,
     kvector_t bas_c = p_lat->getBasisVectorC();
 
 
-    Particle particle(p_material, new FormFactorBox(cube_size, cube_size, cube_size));
+    Particle particle(p_material, new FormFactorFullSphere(cube_size/2.0));
     kvector_t position_0 = kvector_t(0.0, 0.0, 0.0);
     kvector_t position_1 = 1.0/2.0*(bas_a + bas_b + bas_c);
     std::vector<kvector_t> pos_vector;
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1109b2e7d701eff6d232fe20421aca893b7a70be..b8571e037091167b8ee9dbddc41021bf3732959b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@ if(NOT BORNAGAIN_PYTHON)
 endif()
 
 if(NOT BORNAGAIN_APP)
-#    set(BORNAGAIN_APP ON)
+    set(BORNAGAIN_APP ON)
 endif()
 
 if(NOT BORNAGAIN_GUI)
diff --git a/Core/Samples/inc/Layer.h b/Core/Samples/inc/Layer.h
index 1b84913516b96ea9c9ef3eda41af8456b19337ed..a55d45bd442807e8989a2aeff291161d60ea7979 100644
--- a/Core/Samples/inc/Layer.h
+++ b/Core/Samples/inc/Layer.h
@@ -71,7 +71,9 @@ public:
     virtual const IDecoration* getDecoration() const { return mp_decoration; }
 
     //! Returns true if decoration is present
-    virtual bool hasDWBASimulation() const { return (mp_decoration ? true : false); }
+    virtual bool hasDWBASimulation() const {
+        return (mp_decoration ? true : false);
+    }
 
     //! creates and return LayerDWBASimulation in the case of present decoration
     virtual LayerDWBASimulation *createDWBASimulation() const;
diff --git a/Core/Samples/src/Layer.cpp b/Core/Samples/src/Layer.cpp
index f38d136e009f14d1c8d11943dfa289c934c212b6..322797eb281497e73765eb66df3b5e71ddc6575d 100644
--- a/Core/Samples/src/Layer.cpp
+++ b/Core/Samples/src/Layer.cpp
@@ -30,7 +30,6 @@ Layer::Layer()
     init_parameters();
 }
 
-
 Layer::Layer(const IMaterial* material, double thickness, IDecoration *decoration)
     : m_thickness(thickness)
     , mp_decoration(0)
@@ -51,8 +50,6 @@ Layer::Layer(const IMaterial* material, double thickness, const IDecoration &dec
     init_parameters();
 }
 
-
-
 Layer::Layer(const Layer& other) : ICompositeSample()
 {
     mp_material = other.mp_material;
@@ -65,13 +62,11 @@ Layer::Layer(const Layer& other) : ICompositeSample()
     init_parameters();
 }
 
-
 Layer::~Layer()
 {
     delete mp_decoration;
 }
 
-
 Layer* Layer::cloneInvertB() const
 {
     Layer *p_clone = new Layer();
@@ -93,7 +88,6 @@ void Layer::init_parameters()
     registerParameter("thickness", &m_thickness);
 }
 
-
 //! Sets layer thickness in nanometers.
 void Layer::setThickness(double thickness)
 {
@@ -102,7 +96,6 @@ void Layer::setThickness(double thickness)
     m_thickness = thickness;
 }
 
-
 //! Sets _material_ of the layer.
 void Layer::setMaterial(const IMaterial* material)
 {
@@ -111,15 +104,12 @@ void Layer::setMaterial(const IMaterial* material)
     mp_material = material;
 }
 
-
 void Layer::setMaterial(const IMaterial* material, double thickness)
 {
     setMaterial(material);
     setThickness(thickness);
 }
 
-
-
 void Layer::setDecoration(IDecoration *decoration)
 {
     if( !decoration ) return;
@@ -144,7 +134,6 @@ void Layer::print(std::ostream& ostr) const
     ostr << "-->Layer{" <<  *getMaterial() << "}";
 }
 
-
 LayerDWBASimulation *Layer::createDWBASimulation() const
 {
     if(mp_decoration) {
@@ -153,7 +142,6 @@ LayerDWBASimulation *Layer::createDWBASimulation() const
     return 0;
 }
 
-
 DiffuseDWBASimulation* Layer::createDiffuseDWBASimulation() const
 {
     if(!mp_decoration) return 0;
@@ -174,7 +162,9 @@ DiffuseDWBASimulation* Layer::createDiffuseDWBASimulation() const
                 p_sim->addParticleInfo((*p_diffuse_nps)[j]);
             }
             delete p_diffuse_nps;
-            break; // TODO: remove this break (this necessitates the creation of a phi-averaged mesocrystal class generating only one nanoparticle for diffuse calculations)
+            break; // TODO: remove this break (this necessitates the creation
+                   // of a phi-averaged mesocrystal class generating only one
+                   // nanoparticle for diffuse calculations)
         }
     }
     if (p_sim->getSize()>0) {