diff --git a/App/inc/DrawHelper.h b/App/inc/DrawHelper.h
index ae5e257fd7a3b082ca0bc81b6e7d16b8022aef41..952203c033347bad3f5a0f88068f4c63dec2afc0 100644
--- a/App/inc/DrawHelper.h
+++ b/App/inc/DrawHelper.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/DrawHelper.h
@@ -31,7 +31,7 @@ class TPad;
 //!
 class DrawHelper :public TObject
 {
- public:
+public:
     //! Sets own drawing style
     static void SetStyle();
 
@@ -57,7 +57,7 @@ class DrawHelper :public TObject
     //! attempt to draw meso crystal lattice in 3d
     static void DrawMesoCrystal(const MultiLayer *sample);
 
- private:
+private:
     static int m_default_canvas_xsize;
     static int m_default_canvas_ysize;
     static std::vector<TCanvas *> m_registered_canvases;
diff --git a/App/inc/FitSuiteObserverFactory.h b/App/inc/FitSuiteObserverFactory.h
index 884e209860fc3ecedc91e28f49d776e3b7dfc7f7..c879445fd70ea4edc7c591154fe392c19f1a1952 100644
--- a/App/inc/FitSuiteObserverFactory.h
+++ b/App/inc/FitSuiteObserverFactory.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/FitSuiteObserverFactory.h
@@ -24,7 +24,7 @@
 //! factory to create observers for FitSuite
 class FitSuiteObserverFactory
 {
- public:
+public:
     typedef boost::shared_ptr<FitSuitePrintObserver> observer_print_t;
     typedef boost::shared_ptr<FitSuiteDrawObserver> observer_draw_t;
     typedef boost::shared_ptr<FitSuiteWriteTreeObserver> observer_tree_t;
diff --git a/App/inc/FunctionalTestFactory.h b/App/inc/FunctionalTestFactory.h
index 1a3a3ca6c0e32a76e3295d4f9a12f721a12c0275..8b7dd7e82e5d3a70cfdedf24386a047e091d6e13 100644
--- a/App/inc/FunctionalTestFactory.h
+++ b/App/inc/FunctionalTestFactory.h
@@ -27,7 +27,7 @@ class ProgramOptions;
 
 class FunctionalTestFactory : public IFactory<std::string, IFunctionalTest>
 {
-  public:
+public:
     FunctionalTestFactory();
     virtual ~FunctionalTestFactory();
 
@@ -49,7 +49,7 @@ class FunctionalTestFactory : public IFactory<std::string, IFunctionalTest>
     iterator begin() { return m_descriptions.begin(); }
     iterator end() { return m_descriptions.end(); }
 
-  private:
+private:
     TBenchmark *m_benchmark;
 };
 
diff --git a/App/inc/IFunctionalTest.h b/App/inc/IFunctionalTest.h
index 4303b3f0b5ae554c1093bb5b75fcea4eb5014e6d..df6c84ffa9bad24cecf627760c9172d7f560d7cc 100644
--- a/App/inc/IFunctionalTest.h
+++ b/App/inc/IFunctionalTest.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/IFunctionalTest.h
@@ -27,7 +27,7 @@ class ProgramOptions;
 //!
 class IFunctionalTest : public INamed
 {
- public:
+public:
     IFunctionalTest() : mp_options(0) {}
     IFunctionalTest(const std::string& name) : INamed(name), mp_options(0) {}
     virtual ~IFunctionalTest(){}
@@ -39,7 +39,7 @@ class IFunctionalTest : public INamed
     std::string getOutputPath() const { return m_output_path; }
     void setOutputPath(const std::string& output_path)
     { m_output_path = output_path; }
- protected:
+protected:
     ProgramOptions *mp_options;
     std::string m_output_path;
 };
diff --git a/App/inc/IsGISAXSData.h b/App/inc/IsGISAXSData.h
index 8f7a84daf66af65f21b5fa5ab28afc02ef963c3e..1a68bc59f8301de4a276a46799353585d721220b 100644
--- a/App/inc/IsGISAXSData.h
+++ b/App/inc/IsGISAXSData.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/IsGISAXSData.h
@@ -25,7 +25,7 @@
 
 class IsGISAXSData
 {
- public:
+public:
     typedef SafePointerVector<OutputData<double> >  DataSet_t;
     enum ItemToRead { kSin_twotheta, kSin_alphaf, kQx, kQy, kQz,
                       kSimResult, kData2fit, kErrorbar, kIobs_Icalc, kFitted };
@@ -46,7 +46,7 @@ class IsGISAXSData
     //! Read special isgisaxs *.out file with isgisaxs fit results.
     static void read_outfile(const std::string& filename, DataSet_t& dataset, ItemToRead item = kData2fit);
 
- private:
+private:
     //! Convert isgisaxs 1d scan to output data 2d object.
     static OutputData<double> *convert_isgi_scan(
         std::vector<IsgiData >& isgi_data);
diff --git a/App/inc/IsGISAXSTools.h b/App/inc/IsGISAXSTools.h
index 0880f33a6fe9f2adc0c7ebad8421c23e39f2e448..6831eaf7611562fc0bdc6ed23efb8d01f5a66108 100644
--- a/App/inc/IsGISAXSTools.h
+++ b/App/inc/IsGISAXSTools.h
@@ -163,7 +163,7 @@ public:
         double hmax = -1.,
         double hdiff=0.0001 );
 
- private:
+private:
     //! selects specific matrix elements from polarized output data and puts
     //! these in a non-polarized output data structure
     static void copyElementsWithPosition(
diff --git a/App/inc/SampleFactory.h b/App/inc/SampleFactory.h
index 6b8506dd7d7b7ad4dacd7bdad57fc4f69e39bc61..db46a50b787558c668d7fde3dd2c14eab71185bb 100644
--- a/App/inc/SampleFactory.h
+++ b/App/inc/SampleFactory.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/SampleFactory.h
@@ -27,7 +27,7 @@
 class SampleFactory : public ISingleton<SampleFactory>,
                       public IFactory<std::string, ISample>
 {
- public:
+public:
     SampleFactory();
 
     static ISample *createSample(const std::string& sample_name)
diff --git a/App/inc/TestConvolution.h b/App/inc/TestConvolution.h
index 782f37c32d9c252ced2ea8d291aed1031b030aec..b3db376a4190ae6d020be1211eaf2ff9fb732324 100644
--- a/App/inc/TestConvolution.h
+++ b/App/inc/TestConvolution.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/TestConvolution.h
@@ -25,7 +25,7 @@
 
 class TestConvolution : public IFunctionalTest
 {
- public:
+public:
     TestConvolution();
 
     void execute();
@@ -36,7 +36,7 @@ class TestConvolution : public IFunctionalTest
     //! testing convolution in 2d
     void test_convolve2d();
 
- private:
+private:
     //! test function with many gaus'es on top of flat background for convolution studies
     double fpeaks(double *x, double *par);
 
diff --git a/App/inc/TestDetectorResolution.h b/App/inc/TestDetectorResolution.h
index 03badebee99684b41c4efa9015510a52491e66c7..9ab5eda5a75929fce078375b029d34af350fbd64 100644
--- a/App/inc/TestDetectorResolution.h
+++ b/App/inc/TestDetectorResolution.h
@@ -25,7 +25,7 @@
 
 class TestDetectorResolution : public IFunctionalTest
 {
- public:
+public:
     TestDetectorResolution() : mp_intensity_output(0), mp_sample(0) {}
     virtual ~TestDetectorResolution()
     {
@@ -34,7 +34,7 @@ class TestDetectorResolution : public IFunctionalTest
     }
     virtual void execute();
 
- private:
+private:
     void initializeSample();
     OutputData<double> *mp_intensity_output;
     ISample *mp_sample;
diff --git a/App/inc/TestDiffuseReflection.h b/App/inc/TestDiffuseReflection.h
index 5036cf1876d455fce1578fd29664cae7b838bd1e..b6c358f18c89a59e2037bec8365d2bbb2c03b359 100644
--- a/App/inc/TestDiffuseReflection.h
+++ b/App/inc/TestDiffuseReflection.h
@@ -26,14 +26,14 @@ class MultiLayer;
 
 class TestDiffuseReflection : public IFunctionalTest
 {
- public:
+public:
     TestDiffuseReflection();
 
     void execute();
 
     void draw();
 
- private:
+private:
     MultiLayer *m_sample; //!< pointer to multilayer sample
 //    OutputData<double  > *m_data_spec; //!< specular reflectivity
     OutputData<double  > *m_data_offspec; //!< off-specular reflectivity
diff --git a/App/inc/TestFittingBenchmark.h b/App/inc/TestFittingBenchmark.h
index dcd5564a755c8a30589e6ca62af2c656f763434d..0e99541a0c4f96b1ba73629d9d210e20ee1fb637 100644
--- a/App/inc/TestFittingBenchmark.h
+++ b/App/inc/TestFittingBenchmark.h
@@ -22,7 +22,7 @@
 
 class TestFittingBenchmark : public IFunctionalTest
 {
- public:
+public:
     TestFittingBenchmark() {}
     virtual ~TestFittingBenchmark() {}
     virtual void execute();
diff --git a/App/inc/TestFittingModule1.h b/App/inc/TestFittingModule1.h
index b4e6460ccb0a1dcc0b1d69456cf5bbf753c3f922..c177fe42233b94edc8f8271e77de4843323f12ea 100644
--- a/App/inc/TestFittingModule1.h
+++ b/App/inc/TestFittingModule1.h
@@ -28,12 +28,12 @@ class FitSuite;
 
 class TestFittingModule1 : public IFunctionalTest
 {
- public:
+public:
     TestFittingModule1();
     virtual ~TestFittingModule1();
     virtual void execute();
 
- private:
+private:
     //! Initializes sample: layer + nanoparticles, 2 parameters
     void initializeSample1();
     //! Initializes sample: layer + substrate + nanoparticles, 4 parameters
diff --git a/App/inc/TestFittingModule2.h b/App/inc/TestFittingModule2.h
index e1a1026b0bcf88825d0255b6cb753b2ea03c60d5..a3295613914a3578e08459b653b7a4c2a6c0460a 100644
--- a/App/inc/TestFittingModule2.h
+++ b/App/inc/TestFittingModule2.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/TestFittingModule2.h
@@ -34,7 +34,7 @@ class FitSuite;
 //!
 class TestFittingModule2 : public IFunctionalTest
 {
- public:
+public:
     TestFittingModule2();
     virtual ~TestFittingModule2();
     virtual void execute();
@@ -42,13 +42,13 @@ class TestFittingModule2 : public IFunctionalTest
     //! builds sample for fitter testing
     class SampleBuilder : public ISampleBuilder
     {
-      public:
+    public:
         SampleBuilder();
         virtual ~SampleBuilder(){}
         virtual ISample *buildSample() const;
-      protected:
+    protected:
         virtual void init_parameters();
-      private:
+    private:
         double m_cylinder_height;
         double m_cylinder_radius;
         double m_prism3_half_side;
@@ -68,7 +68,7 @@ class TestFittingModule2 : public IFunctionalTest
     //! fit example with data masking
     void fit_example_mask();
 
- private:
+private:
     void initializeSimulation();
     void initializeRealData();
 
diff --git a/App/inc/TestFittingModule3.h b/App/inc/TestFittingModule3.h
index 2386cf2a2e3adf2040951830b673d2ccbb5f41ad..9dfbb87404e926e925051a95ad21340eca99464d 100644
--- a/App/inc/TestFittingModule3.h
+++ b/App/inc/TestFittingModule3.h
@@ -32,14 +32,14 @@ class FitSuite;
 //!
 class TestFittingModule3 : public IFunctionalTest
 {
- public:
+public:
     typedef SafePointerVector<OutputData<double> >  DataScan_t;
 
     TestFittingModule3();
     virtual ~TestFittingModule3();
     virtual void execute();
 
- private:
+private:
     void initializeSample();
     void initializeSimulation();
     void initializeRealData();
diff --git a/App/inc/TestFormFactor.h b/App/inc/TestFormFactor.h
index b231e15e4b7587c8dec1d9db3f90550176446fe1..e97be13508a33abce9287382dff76908bb12e029 100644
--- a/App/inc/TestFormFactor.h
+++ b/App/inc/TestFormFactor.h
@@ -22,13 +22,13 @@
 
 class TestFormFactor : public IFunctionalTest
 {
- public:
+public:
     TestFormFactor();
     ~TestFormFactor();
     virtual void execute();
     void draw(), draw4();
 
- private:
+private:
     OutputData<double> *mp_intensity_output;
     FormFactorCylinder m_ff;
 };
diff --git a/App/inc/TestFormFactors.h b/App/inc/TestFormFactors.h
index 205402f06f1f8f6d501f22df4c0fab29ca9980c9..65a0cbaca8949a862a11b125bedd9527848b18d8 100644
--- a/App/inc/TestFormFactors.h
+++ b/App/inc/TestFormFactors.h
@@ -24,13 +24,13 @@
 
 class TestFormFactors : public IFunctionalTest
 {
- public:
+public:
     TestFormFactors(){}
     virtual ~TestFormFactors(){}
 
     virtual void execute();
     virtual void finalise();
- private:
+private:
     std::string m_data_path;
 };
 
diff --git a/App/inc/TestFourier.h b/App/inc/TestFourier.h
index c4703613c05d59482f48011490f58c02ff1b8c84..26674191e2c2297c07dd111c028b382f737df435 100644
--- a/App/inc/TestFourier.h
+++ b/App/inc/TestFourier.h
@@ -22,12 +22,12 @@
 
 class TestFourier : public IFunctionalTest
 {
- public:
+public:
     TestFourier();
     virtual ~TestFourier();
     virtual void execute();
 
- private:
+private:
     void initializeSample();
     OutputData<double> *mp_intensity_output;
     ISample *mp_sample;
diff --git a/App/inc/TestFumiliLMA.h b/App/inc/TestFumiliLMA.h
index d52bc6e5289a4058fe39566c2f21202a1e7cb4e3..88c2e54e2390bac4c614a8ab97b9e525b917fa31 100644
--- a/App/inc/TestFumiliLMA.h
+++ b/App/inc/TestFumiliLMA.h
@@ -36,7 +36,7 @@ class TCanvas;
 
 class TestFumiliLMA : public IFunctionalTest
 {
- public:
+public:
     friend class MyChi2Function;
 
     TestFumiliLMA();
@@ -45,7 +45,7 @@ class TestFumiliLMA : public IFunctionalTest
 
     double functionToMinimize(const double *pars);
 
- private:
+private:
     void FillOutputDataFromFunction(
         OutputData<double>& data, TF2 *fun, int nbinsx=100, int nbinsy=100);
 
@@ -63,7 +63,7 @@ class TestFumiliLMA : public IFunctionalTest
 
 class IFunctionObject
 {
- public:
+public:
     virtual ~IFunctionObject(){}
     virtual double operator()(const double *xx, const double *pars ) = 0;
 };
@@ -71,7 +71,7 @@ class IFunctionObject
 
 class RosenBrockFunctionObject : public IFunctionObject
 {
- public:
+public:
     double operator()(const double *xx, const double *pars )
     {
         const double x = xx[0];
@@ -87,7 +87,7 @@ class RosenBrockFunctionObject : public IFunctionObject
 
 class SincXSincYFunctionObject : public IFunctionObject
 {
- public:
+public:
     double operator()(const double *xx, const double *pars )
     {
         const double x = xx[0];
@@ -103,7 +103,7 @@ class SincXSincYFunctionObject : public IFunctionObject
 
 class MyChi2Function : public ROOT::Math::FitMethodFunction
 {
- public:
+public:
     typedef ROOT::Math::BasicFitMethodFunction<ROOT::Math::IMultiGenFunction>::Type_t  Type_t;
 
     MyChi2Function(TestFumiliLMA *test)
diff --git a/App/inc/TestIsGISAXS1.h b/App/inc/TestIsGISAXS1.h
index b1ba22d8cc4afb0b1c3f5ee6d72282f118cfb775..6416d986bc77cd8c36abf84a638ffbaaecd1ec7c 100644
--- a/App/inc/TestIsGISAXS1.h
+++ b/App/inc/TestIsGISAXS1.h
@@ -22,7 +22,7 @@
 
 class TestIsGISAXS1 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS1();
     virtual ~TestIsGISAXS1() { }
 
diff --git a/App/inc/TestIsGISAXS10.h b/App/inc/TestIsGISAXS10.h
index 771d5ac562fceef9f4aa90a1d61d00501672f151..1a5e676cf30b4313a57993a015379ba45d2978fb 100644
--- a/App/inc/TestIsGISAXS10.h
+++ b/App/inc/TestIsGISAXS10.h
@@ -22,7 +22,7 @@
 
 class TestIsGISAXS10 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS10();
     virtual ~TestIsGISAXS10(){}
 
diff --git a/App/inc/TestIsGISAXS11.h b/App/inc/TestIsGISAXS11.h
index 01dd7f04615e19b7d830f8a07e4be1c5b666281c..6fc14087a1db22ce8e432cf45d278547f046e4ea 100644
--- a/App/inc/TestIsGISAXS11.h
+++ b/App/inc/TestIsGISAXS11.h
@@ -22,7 +22,7 @@
 
 class TestIsGISAXS11 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS11();
     virtual ~TestIsGISAXS11(){ }
 
diff --git a/App/inc/TestIsGISAXS12.h b/App/inc/TestIsGISAXS12.h
index e89335f2e5bdc0a08d3a96a9fc3a706d5e491410..8091661cba7726f34a06b157bb409336cbe17251 100644
--- a/App/inc/TestIsGISAXS12.h
+++ b/App/inc/TestIsGISAXS12.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/TestIsGISAXS12.h
@@ -30,12 +30,12 @@ class FitSuite;
 
 class TestIsGISAXS12 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS12();
     virtual ~TestIsGISAXS12();
     virtual void execute();
 
- private:
+private:
 
     //! builds IsGISAXS ex-12 sample
     class TestSampleBuilder : public ISampleBuilder
diff --git a/App/inc/TestIsGISAXS13.h b/App/inc/TestIsGISAXS13.h
index 812226c8a2b86d3d2b7b9983596225ea32c37341..3e9a5d01daaa5828942eb24771910e2cab16c4ab 100644
--- a/App/inc/TestIsGISAXS13.h
+++ b/App/inc/TestIsGISAXS13.h
@@ -29,13 +29,13 @@ class FitSuite;
 //!
 class TestIsGISAXS13 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS13();
     virtual ~TestIsGISAXS13() { }
 
     virtual void execute();
 
- private:
+private:
     //! Initializes simulation
     void initializeSimulation();
 
diff --git a/App/inc/TestIsGISAXS14.h b/App/inc/TestIsGISAXS14.h
index 91ab41520db2d9fc0816b30f99c5343eca966907..09a8d2ed059f70cfe32c537557972c2616253297 100644
--- a/App/inc/TestIsGISAXS14.h
+++ b/App/inc/TestIsGISAXS14.h
@@ -22,7 +22,7 @@
 
 class TestIsGISAXS14 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS14();
     virtual ~TestIsGISAXS14() {}
     virtual void execute();
diff --git a/App/inc/TestIsGISAXS15.h b/App/inc/TestIsGISAXS15.h
index 3c7ded62ee7a448b5d53be75fcb5822eada456eb..3515efd41cee705848e20143f738b7fa13a29fe6 100644
--- a/App/inc/TestIsGISAXS15.h
+++ b/App/inc/TestIsGISAXS15.h
@@ -22,13 +22,13 @@
 
 class TestIsGISAXS15 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS15();
     virtual ~TestIsGISAXS15(){}
 
     virtual void execute();
     virtual void finalise();
- private:
+private:
     // structure to hold info over several compare cases
     struct CompareStruct
     {
diff --git a/App/inc/TestIsGISAXS2.h b/App/inc/TestIsGISAXS2.h
index aff585a6b2f7005f5f82b3489b6cd1b74308d8a4..adfacea784070fdaf50d1b33a6070c977e790a76 100644
--- a/App/inc/TestIsGISAXS2.h
+++ b/App/inc/TestIsGISAXS2.h
@@ -26,7 +26,7 @@
 
 class TestIsGISAXS2 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS2();
     virtual ~TestIsGISAXS2(){}
 
diff --git a/App/inc/TestIsGISAXS3.h b/App/inc/TestIsGISAXS3.h
index 0289ebef01d6d494b12bfe77757fe01a431a6212..8060a34521b5db67a433afc6f62792c9d250d721 100644
--- a/App/inc/TestIsGISAXS3.h
+++ b/App/inc/TestIsGISAXS3.h
@@ -25,13 +25,13 @@
 
 class TestIsGISAXS3 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS3();
     virtual ~TestIsGISAXS3(){}
     virtual void execute();
     virtual void finalise();
 
- private:
+private:
     // structure to hold info over several compare cases
     struct CompareStruct
     {
diff --git a/App/inc/TestIsGISAXS4.h b/App/inc/TestIsGISAXS4.h
index 99cff3e90d89917fbab544264f9c9b54da5efb41..b95958163a310293a5ada34a0a095808bb26dc6f 100644
--- a/App/inc/TestIsGISAXS4.h
+++ b/App/inc/TestIsGISAXS4.h
@@ -22,13 +22,13 @@
 
 class TestIsGISAXS4 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS4();
     virtual ~TestIsGISAXS4(){}
 
     virtual void execute();
     virtual void finalise();
- private:
+private:
     // structure to hold info over several compare cases
     struct CompareStruct
     {
diff --git a/App/inc/TestIsGISAXS5.h b/App/inc/TestIsGISAXS5.h
index 7459b1249d8706268f3eb17371cd167afe390ce8..539e62b5012334c778d5cfc8bd57e003c6d4a601 100644
--- a/App/inc/TestIsGISAXS5.h
+++ b/App/inc/TestIsGISAXS5.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/TestIsGISAXS5.h
@@ -27,7 +27,7 @@ class FitSuite;
 
 class TestIsGISAXS5 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS5();
     virtual ~TestIsGISAXS5() { }
 
@@ -49,7 +49,7 @@ class TestIsGISAXS5 : public IFunctionalTest
         double m_interf_width;
     };
 
- private:
+private:
 
     //! Initializes simulation
     void initializeSimulation();
diff --git a/App/inc/TestIsGISAXS6.h b/App/inc/TestIsGISAXS6.h
index 75cba2b6b2652624dcd5f56da1d0016bd1102235..d02577859dbb67cc90f6993d4206f75fca0c4a5b 100644
--- a/App/inc/TestIsGISAXS6.h
+++ b/App/inc/TestIsGISAXS6.h
@@ -23,13 +23,13 @@
 
 class TestIsGISAXS6 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS6();
     virtual ~TestIsGISAXS6(){}
 
     virtual void execute();
     virtual void finalise();
- private:
+private:
     // structure to hold info over several compare cases
     struct CompareStruct
     {
diff --git a/App/inc/TestIsGISAXS7.h b/App/inc/TestIsGISAXS7.h
index 5c349f46af71e2c3f53f409f0f3696b1fad379a0..d0bf508bb5e9267c8f8dbc28a71829cf97af9ad1 100644
--- a/App/inc/TestIsGISAXS7.h
+++ b/App/inc/TestIsGISAXS7.h
@@ -41,7 +41,7 @@
 //!
 class TestIsGISAXS7 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS7();
     virtual ~TestIsGISAXS7(){}
     virtual void execute();
diff --git a/App/inc/TestIsGISAXS8.h b/App/inc/TestIsGISAXS8.h
index 991e02e203068791554c2080d54195c2a5b1b8e6..55428de889d3d7dbe04b02ce115079d01765dce2 100644
--- a/App/inc/TestIsGISAXS8.h
+++ b/App/inc/TestIsGISAXS8.h
@@ -22,13 +22,13 @@
 
 class TestIsGISAXS8 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS8();
     virtual ~TestIsGISAXS8(){}
 
     virtual void execute();
     virtual void finalise();
- private:
+private:
     // structure to hold info over several compare cases
     struct CompareStruct
     {
diff --git a/App/inc/TestIsGISAXS9.h b/App/inc/TestIsGISAXS9.h
index fd6a7fc0f638d93c3dfe710152c21e1f48c121b2..05092f760bed68d2ae7ee237b382687a7386cce3 100644
--- a/App/inc/TestIsGISAXS9.h
+++ b/App/inc/TestIsGISAXS9.h
@@ -24,7 +24,7 @@
 
 class TestIsGISAXS9 : public IFunctionalTest
 {
- public:
+public:
     TestIsGISAXS9();
      virtual ~TestIsGISAXS9() { }
 
diff --git a/App/inc/TestMesoCrystal1.h b/App/inc/TestMesoCrystal1.h
index 65f878a2c9fc331c809c2035ea62f3162ed9fb66..437afe6c6bd41840e5dce8041f450d572e05f42a 100644
--- a/App/inc/TestMesoCrystal1.h
+++ b/App/inc/TestMesoCrystal1.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/TestMesoCrystal1.h
@@ -30,7 +30,7 @@
 
 class TestMesoCrystal1 : public IFunctionalTest
 {
- public:
+public:
     TestMesoCrystal1();
     virtual ~TestMesoCrystal1();
     virtual void execute();
@@ -61,7 +61,7 @@ class TestMesoCrystal1 : public IFunctionalTest
         double m_roughness;
     };
 
- private:
+private:
     OutputData<double> *mp_intensity_output;
     ISampleBuilder *mp_sample_builder;
 };
diff --git a/App/inc/TestMesoCrystal2.h b/App/inc/TestMesoCrystal2.h
index 5a93903e65e3273d64f35f0720d81cae9b114f47..eec912e4f4ca4403ddb6ce4211f9364ba0a1fe4f 100644
--- a/App/inc/TestMesoCrystal2.h
+++ b/App/inc/TestMesoCrystal2.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/TestMesoCrystal2.h
@@ -32,7 +32,7 @@ class FitSuite;
 
 class TestMesoCrystal2 : public IFunctionalTest
 {
- public:
+public:
     typedef std::vector<std::vector<std::string > > fixplan_t; // to hold sets of fit parameters to fix/release
 
     TestMesoCrystal2();
@@ -77,7 +77,7 @@ class TestMesoCrystal2 : public IFunctionalTest
     void fitsuite_config3();
     void fitsuite_config4();
 
- private:
+private:
     void initializeRealData();
     void initializeSimulation(const OutputData<double> *output_data=0);
 
diff --git a/App/inc/TestMiscellaneous.h b/App/inc/TestMiscellaneous.h
index 839e080fed4634121a38838e3d1d560ed530b331..0709619f566e4d7e59aedc40580d4d7524179cca 100644
--- a/App/inc/TestMiscellaneous.h
+++ b/App/inc/TestMiscellaneous.h
@@ -22,7 +22,7 @@
 
 class TestMiscellaneous : public IFunctionalTest
 {
- public:
+public:
     TestMiscellaneous();
     virtual ~TestMiscellaneous(){}
 
diff --git a/App/inc/TestMultiLayerRoughness.h b/App/inc/TestMultiLayerRoughness.h
index 716c59745bef2cce2d8707f1ec332ab8ad400d10..6e22498d68224438d03d0fb853c355f764c7e531 100644
--- a/App/inc/TestMultiLayerRoughness.h
+++ b/App/inc/TestMultiLayerRoughness.h
@@ -26,7 +26,7 @@
 //!
 class TestMultiLayerRoughness : public IFunctionalTest
 {
- public:
+public:
     TestMultiLayerRoughness() {}
     virtual ~TestMultiLayerRoughness(){}
 
diff --git a/App/inc/TestPerformance.h b/App/inc/TestPerformance.h
index ed335b2c0a146ac58129e1a97c37e7a428ea73b5..273ac49d62dd8c9d00fdc877692c2b0d868e4978 100644
--- a/App/inc/TestPerformance.h
+++ b/App/inc/TestPerformance.h
@@ -30,7 +30,7 @@
 
 class TestPerformance : public IFunctionalTest
 {
- public:
+public:
     //! class to hold performance information over functional test
     class PerformanceTestInfo {
     public:
@@ -48,7 +48,7 @@ class TestPerformance : public IFunctionalTest
     virtual ~TestPerformance();
 
     virtual void execute();
- private:
+private:
     //! fill system information
     void get_sysinfo();
 
@@ -68,7 +68,7 @@ class TestPerformance : public IFunctionalTest
 //! measurement of the performance in specular matrix calculation
 class PerfTest_SpecularMatrix : public IFunctionalTest
 {
- public:
+public:
     PerfTest_SpecularMatrix() : IFunctionalTest("SpecularMatrix"), m_sample(0){}
     virtual ~PerfTest_SpecularMatrix() { }
     void initialise(ProgramOptions *p_options);
@@ -80,7 +80,7 @@ class PerfTest_SpecularMatrix : public IFunctionalTest
 //! measurement of the performance in pyramid form factor calculations
 class PerfTest_Pyramid : public IFunctionalTest
 {
- public:
+public:
     PerfTest_Pyramid()
         : IFunctionalTest("Pyramid"), m_sample(0), m_simulation(0) {}
     virtual ~PerfTest_Pyramid() { delete m_simulation; }
@@ -94,7 +94,7 @@ class PerfTest_Pyramid : public IFunctionalTest
 //! measurement of the performance in pyramid formfactor and in rotation mechanism
 class PerfTest_RotatedPyramid : public IFunctionalTest
 {
- public:
+public:
     PerfTest_RotatedPyramid()
         : IFunctionalTest("RotatedPyramid"), m_sample(0), m_simulation(0) {}
     virtual ~PerfTest_RotatedPyramid() { delete m_simulation; }
@@ -109,7 +109,7 @@ class PerfTest_RotatedPyramid : public IFunctionalTest
 //! measurement of the performance iof meso crystal
 class PerfTest_MesoCrystal : public IFunctionalTest
 {
- public:
+public:
     PerfTest_MesoCrystal()
         : IFunctionalTest("MesoCrystal"), m_sample(0), m_simulation(0) {}
     virtual ~PerfTest_MesoCrystal() { delete m_simulation; }
diff --git a/App/inc/TestRootTree.h b/App/inc/TestRootTree.h
index c95fdae251c9e00ae3adf938f50f5a2b114b1c92..1ee60ace26cce6da3998117d8a8afb714f058059 100644
--- a/App/inc/TestRootTree.h
+++ b/App/inc/TestRootTree.h
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/inc/TestRootTree.h
@@ -25,7 +25,7 @@
 
 class TestRootTree : public IFunctionalTest
 {
- public:
+public:
     TestRootTree() : mp_sample(0), mp_simulation(0), mp_data(0) {}
     virtual ~TestRootTree()
     {
@@ -45,7 +45,7 @@ class TestRootTree : public IFunctionalTest
 
     virtual void execute();
 
- private:
+private:
     //! example showing writing in the tree simple data structures
     void simple_write();
 
diff --git a/App/inc/TestRoughness.h b/App/inc/TestRoughness.h
index b93f2fcbbb257506ca0544377dfbfb59def798c9..ea91f8c2b2ab18fe40ebdf4c35085b7312e4b4bc 100644
--- a/App/inc/TestRoughness.h
+++ b/App/inc/TestRoughness.h
@@ -27,7 +27,7 @@
 //!
 class TestRoughness : public IFunctionalTest
 {
- public:
+public:
     TestRoughness() : IFunctionalTest("roughness"), m_roughness(0) {}
     virtual ~TestRoughness(){}
 
@@ -45,7 +45,7 @@ class TestRoughness : public IFunctionalTest
     //! Some tests of FFT.
     void test_FFT();
 
- private:
+private:
     //! pointer to roughness
     LayerRoughness *m_roughness;
     //! x-coordinates of grid along the surface
diff --git a/App/inc/TestToySimulation.h b/App/inc/TestToySimulation.h
index c7016f87b76339d4eeb95e2cb4e601ccec7b2ba8..1252fa506dd7249f740f2ef1fe7416fb798a7667 100644
--- a/App/inc/TestToySimulation.h
+++ b/App/inc/TestToySimulation.h
@@ -29,7 +29,7 @@
 
 class ToySimulation : public Simulation
 {
- public:
+public:
     ToySimulation(TF2 *func)
         : m_func(func)
     {
@@ -42,9 +42,9 @@ class ToySimulation : public Simulation
     virtual ToySimulation *clone() const
     { return new ToySimulation(*this); }
     void setParameter(size_t i, double value) { pars[i] = value; }
- protected:
+protected:
     virtual void init_parameters();
- private:
+private:
     ToySimulation(const ToySimulation& other)
         : Simulation(other), m_func(other.m_func), pars(other.pars)
     {
@@ -59,12 +59,12 @@ class ToySimulation : public Simulation
 
 class TestToySimulation : public IFunctionalTest
 {
- public:
+public:
     TestToySimulation();
     virtual ~TestToySimulation();
     virtual void execute();
 
- private:
+private:
     void initializeSimulationAndRealData();
 
     //! simulation function
diff --git a/App/inc/TreeEventStructure.h b/App/inc/TreeEventStructure.h
index 14479a1635209ddea692d03ef51b9d58510668f1..e786dd31a740ca647ef1c8131d2f515b4a888de1 100644
--- a/App/inc/TreeEventStructure.h
+++ b/App/inc/TreeEventStructure.h
@@ -26,7 +26,7 @@
 //!
 class TreeEventOutputData
 {
- public:
+public:
     TreeEventOutputData() { clear(); }
     virtual ~TreeEventOutputData() { }
 
@@ -59,7 +59,7 @@ class TreeEventOutputData
 
 class TreeEventFitData
 {
- public:
+public:
     TreeEventFitData() { clear(); }
     virtual ~TreeEventFitData()  { }
     void clear();
diff --git a/App/src/StandardSamples.cpp b/App/src/StandardSamples.cpp
index f8c68c40c7aa61a088f0675d4a232f95fcc7379f..8c3b95fbab3af2eadd7bbe199b345c43762dc8a4 100644
--- a/App/src/StandardSamples.cpp
+++ b/App/src/StandardSamples.cpp
@@ -284,7 +284,7 @@ ISample *StandardSamples::IsGISAXS7_morphology()
                    0.0);
     Geometry::PTransform3D m2(new Geometry::RotateZ_3D(10*Units::degree));
     PositionParticleInfo particle_info2
-        (new Particle(particle_material, ff2), m2, pos2, 0.5);
+        (new Particle(particle_material, ff2, m2), pos2, 0.5);
     particle_decoration.addParticleInfo(particle_info2);
     // add particle number 3:
     FormFactorBox ff3(1.0*Units::nanometer,
@@ -295,7 +295,7 @@ ISample *StandardSamples::IsGISAXS7_morphology()
                    0.0);
     Geometry::PTransform3D m3(new Geometry::RotateZ_3D(20*Units::degree));
     PositionParticleInfo particle_info3
-        (new Particle(particle_material, ff3), m3, pos3, 0.5);
+        (new Particle(particle_material, ff3, m3), pos3, 0.5);
     particle_decoration.addParticleInfo(particle_info3);
     // add particle number 4:
     FormFactorBox ff4(1.0*Units::nanometer,
@@ -306,7 +306,7 @@ ISample *StandardSamples::IsGISAXS7_morphology()
                    0.0);
     Geometry::PTransform3D m4(new Geometry::RotateZ_3D(30*Units::degree));
     PositionParticleInfo particle_info4
-        (new Particle(particle_material, ff4), m4, pos4, 0.5);
+        (new Particle(particle_material, ff4, m4), pos4, 0.5);
     particle_decoration.addParticleInfo(particle_info4);
     // add particle number 5:
     FormFactorBox ff5(1.0*Units::nanometer,
@@ -317,7 +317,7 @@ ISample *StandardSamples::IsGISAXS7_morphology()
                    0.0);
     Geometry::PTransform3D m5(new Geometry::RotateZ_3D(40*Units::degree));
     PositionParticleInfo particle_info5
-        (new Particle(particle_material, ff5), m5, pos5, 0.5);
+        (new Particle(particle_material, ff5, m5), pos5, 0.5);
     particle_decoration.addParticleInfo(particle_info5);
     // add particle number 6:
     FormFactorBox ff6(1.0*Units::nanometer,
@@ -328,7 +328,7 @@ ISample *StandardSamples::IsGISAXS7_morphology()
                    0.0);
     Geometry::PTransform3D m6(new Geometry::RotateZ_3D(50*Units::degree));
     PositionParticleInfo particle_info6
-        (new Particle(particle_material, ff6), m6, pos6, 0.5);
+        (new Particle(particle_material, ff6, m6), pos6, 0.5);
     particle_decoration.addParticleInfo(particle_info6);
     // add particle number 7:
     FormFactorBox ff7(1.0*Units::nanometer,
@@ -337,7 +337,7 @@ ISample *StandardSamples::IsGISAXS7_morphology()
     kvector_t pos7(5.0*Units::nanometer, 5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m7(new Geometry::RotateZ_3D(60*Units::degree));
     PositionParticleInfo particle_info7
-        (new Particle(particle_material, ff7), m7, pos7, 0.5);
+        (new Particle(particle_material, ff7, m7), pos7, 0.5);
     particle_decoration.addParticleInfo(particle_info7);
     // add particle number 8:
     FormFactorBox ff8(1.0*Units::nanometer,
@@ -346,7 +346,7 @@ ISample *StandardSamples::IsGISAXS7_morphology()
     kvector_t pos8(-5.0*Units::nanometer, -5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m8(new Geometry::RotateZ_3D(70*Units::degree));
     PositionParticleInfo particle_info8
-        (new Particle(particle_material, ff8), m8, pos8, 0.5);
+        (new Particle(particle_material, ff8, m8), pos8, 0.5);
     particle_decoration.addParticleInfo(particle_info8);
     // add particle number 9:
     FormFactorBox ff9(1.0*Units::nanometer,
@@ -355,7 +355,7 @@ ISample *StandardSamples::IsGISAXS7_morphology()
     kvector_t pos9(5.0*Units::nanometer, -5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m9(new Geometry::RotateZ_3D(80*Units::degree));
     PositionParticleInfo particle_info9
-        (new Particle(particle_material, ff9), m9, pos9, 0.5);
+        (new Particle(particle_material, ff9, m9), pos9, 0.5);
     particle_decoration.addParticleInfo(particle_info9);
     // add particle number 10:
     FormFactorBox ff10(1.0*Units::nanometer,
@@ -364,7 +364,7 @@ ISample *StandardSamples::IsGISAXS7_morphology()
     kvector_t pos10(-5.0*Units::nanometer, 5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m10(new Geometry::RotateZ_3D(90*Units::degree));
     PositionParticleInfo particle_info10
-        (new Particle(particle_material, ff10), m10, pos10, 0.5);
+        (new Particle(particle_material, ff10, m10), pos10, 0.5);
     particle_decoration.addParticleInfo(particle_info10);
 
     air_layer.setDecoration(particle_decoration);
diff --git a/App/src/TestFormFactor.cpp b/App/src/TestFormFactor.cpp
index c6193f1d46fcd847d3b2b1ebfb60e553d99ca0a8..5e7b0c4bec41abf09b46ce93300bf2abcb398dc9 100644
--- a/App/src/TestFormFactor.cpp
+++ b/App/src/TestFormFactor.cpp
@@ -1,5 +1,5 @@
 // ************************************************************************** //
-//                                                                         
+//
 //  BornAgain: simulate and fit scattering at grazing incidence
 //
 //! @file      App/src/TestFormFactor.cpp
@@ -51,14 +51,19 @@ void TestFormFactor::execute()
     k_i.setLambdaAlphaPhi(lambda, -alpha_i, 0.0);
     while (it != mp_intensity_output->end())
     {
-        size_t index_y = mp_intensity_output->getIndexOfAxis("detector y-axis", it.getIndex());
-        size_t index_z = mp_intensity_output->getIndexOfAxis("detector z-axis", it.getIndex());
+        size_t index_y = mp_intensity_output->getIndexOfAxis("detector y-axis",
+                it.getIndex());
+        size_t index_z = mp_intensity_output->getIndexOfAxis("detector z-axis",
+                it.getIndex());
         double phi_f = M_PI*(*p_y_axis)[index_y]/180.0;
-        double alpha_f = M_PI*(*p_z_axis)[index_z]/180.0;
+        Bin1D alpha_f_bin_degrees = p_z_axis->getBin(index_z);
+        Bin1D alpha_f_bin = { M_PI*alpha_f_bin_degrees.m_lower/180.0,
+                              M_PI*alpha_f_bin_degrees.m_upper/180.0 };
+        double alpha_f = alpha_f_bin.getMidPoint();
         cvector_t k_f;
         k_f.setLambdaAlphaPhi(lambda, alpha_f, phi_f);
         Bin1DCVector k_f_zero_bin(k_f, k_f);
-        *it = std::pow(std::abs(m_ff.evaluate(k_i, k_f_zero_bin, alpha_i, alpha_f)),2);
+        *it = std::pow(std::abs(m_ff.evaluate(k_i, k_f_zero_bin, alpha_f_bin)),2);
         ++it;
     }
     draw4();
@@ -67,11 +72,8 @@ void TestFormFactor::execute()
 
 void TestFormFactor::draw4()
 {
-    // creation of 2D histogram from calculated intensities
-   // TCanvas *c1 = new TCanvas("c1_test_formfactor", "Cylinder Formfactor", 0, 0, 1024, 768);
-   // (void)c1;
-
-    TCanvas *c1_xy = new TCanvas("c1_test_formfactor","Cylinder Formfactor",1024,768);
+    TCanvas *c1_xy = new TCanvas("c1_test_formfactor", "Cylinder Formfactor",
+            1024, 768);
     gPad->SetRightMargin(0.11);
     gStyle->SetPalette(1);
     gStyle->SetOptStat(0);
@@ -104,7 +106,8 @@ void TestFormFactor::draw4()
         p_hist2Da[i]->GetYaxis()->SetTitle("alpha_{f} (rad)");
     }
 
-    TH2D *p_hist2D = new TH2D("p_hist2D", "Cylinder Formfactor", (int)y_size, y_start, y_end, (int)z_size, z_start, z_end);
+    TH2D *p_hist2D = new TH2D("p_hist2D", "Cylinder Formfactor",
+            (int)y_size, y_start, y_end, (int)z_size, z_start, z_end);
     //p_hist2D->UseCurrentStyle();
     p_hist2D->GetXaxis()->SetTitle("phi_{f} (rad)");
     p_hist2D->GetYaxis()->SetTitle("alpha_{f} (rad)");
@@ -113,8 +116,10 @@ void TestFormFactor::draw4()
     //OutputData<double>::const_iterator it = mp_intensity_output->begin();
     while (it != mp_intensity_output->end())
     {
-        size_t index_y = mp_intensity_output->getIndexOfAxis("detector y-axis", it.getIndex());
-        size_t index_z = mp_intensity_output->getIndexOfAxis("detector z-axis", it.getIndex());
+        size_t index_y = mp_intensity_output->getIndexOfAxis("detector y-axis",
+                it.getIndex());
+        size_t index_z = mp_intensity_output->getIndexOfAxis("detector z-axis",
+                it.getIndex());
         double x_value = (*p_y_axis)[index_y];
         double y_value = (*p_z_axis)[index_z];
         double z_value = std::log(*it);
@@ -141,7 +146,8 @@ void TestFormFactor::draw4()
 void TestFormFactor::draw()
 {
     // creation of 2D histogram from calculated intensities
-    TCanvas *c1 = new TCanvas("c1_test_formfactor", "Cylinder Formfactor", 0, 0, 1024, 768);
+    TCanvas *c1 = new TCanvas("c1_test_formfactor", "Cylinder Formfactor", 0, 0,
+            1024, 768);
     (void)c1;
 
     const IAxis *p_y_axis = mp_intensity_output->getAxis("detector y-axis");
@@ -152,7 +158,8 @@ void TestFormFactor::draw()
     double y_end = (*p_y_axis)[y_size-1];
     double z_start = (*p_z_axis)[0];
     double z_end = (*p_z_axis)[z_size-1];
-    TH2D *p_hist2D = new TH2D("p_hist2D", "Cylinder Formfactor", (int)y_size, y_start, y_end, (int)z_size, z_start, z_end);
+    TH2D *p_hist2D = new TH2D("p_hist2D", "Cylinder Formfactor", (int)y_size,
+            y_start, y_end, (int)z_size, z_start, z_end);
     p_hist2D->UseCurrentStyle();
     p_hist2D->GetXaxis()->SetTitle("phi_f");
     p_hist2D->GetYaxis()->SetTitle("alpha_f");
@@ -160,8 +167,10 @@ void TestFormFactor::draw()
     OutputData<double>::const_iterator it = mp_intensity_output->begin();
     while (it != mp_intensity_output->end())
     {
-        size_t index_y = mp_intensity_output->getIndexOfAxis("detector y-axis", it.getIndex());
-        size_t index_z = mp_intensity_output->getIndexOfAxis("detector z-axis", it.getIndex());
+        size_t index_y = mp_intensity_output->getIndexOfAxis("detector y-axis",
+                it.getIndex());
+        size_t index_z = mp_intensity_output->getIndexOfAxis("detector z-axis",
+                it.getIndex());
         double x_value = (*p_y_axis)[index_y];
         double y_value = (*p_z_axis)[index_z];
         double z_value = std::log(*it);
diff --git a/App/src/TestMiscellaneous.cpp b/App/src/TestMiscellaneous.cpp
index 1d670895b9cbdac6c8da173471aa91a539b95265..b63ebeaf2d478eb7962e997b0f792740ae94f89b 100644
--- a/App/src/TestMiscellaneous.cpp
+++ b/App/src/TestMiscellaneous.cpp
@@ -273,18 +273,19 @@ void TestMiscellaneous::test_FormFactor()
         cvector_t q(x,y,z);
         cvector_t q0(0,0,0);
         Bin1DCVector q0_bin(q0, q0);
-        double value = std::abs(ff.evaluate(q,q0_bin, 0.0, 0.0));
-        if(iz==50) h2->Fill(x,y,std::abs(ff.evaluate(q,q0_bin, 0.0, 0.0)));
+        Bin1D zero_bin = { 0.0, 0.0 };
+        double value = std::abs(ff.evaluate(q,q0_bin, zero_bin));
+        if(iz==50) h2->Fill(x,y,std::abs(ff.evaluate(q,q0_bin, zero_bin)));
 
-        h3->Fill(x,y,z,std::abs(ff.evaluate(q,q0_bin, 0.0, 0.0)));
+        h3->Fill(x,y,z,std::abs(ff.evaluate(q,q0_bin, zero_bin)));
 
         if(iy==0 && iz==0) {
             cvector_t kx(x,1.0,1.0);
             cvector_t ky(1.0,x,1.0);
             cvector_t kz(1.0,1.0,x);
-            h1[0]->Fill(x, std::abs(ff.evaluate(kx,q0_bin, 0.0, 0.0)));
-            h1[1]->Fill(x, std::abs(ff.evaluate(ky,q0_bin, 0.0, 0.0)));
-            h1[2]->Fill(x, std::abs(ff.evaluate(kz,q0_bin, 0.0, 0.0)));
+            h1[0]->Fill(x, std::abs(ff.evaluate(kx,q0_bin, zero_bin)));
+            h1[1]->Fill(x, std::abs(ff.evaluate(ky,q0_bin, zero_bin)));
+            h1[2]->Fill(x, std::abs(ff.evaluate(kz,q0_bin, zero_bin)));
         }
 
         vh2_xy[iz] ->Fill(x,y,value);
@@ -385,10 +386,11 @@ void TestMiscellaneous::test_FormFactor1()
         cvector_t q(x,y,z);
         cvector_t q0(0,0,0);
         Bin1DCVector q0_bin(q0, q0);
-        double value = std::abs(ff.evaluate(q,q0_bin, 0.0, 0.0));
-        //double valuep = std::abs(ff.evaluate(q,q0_bin, 0.0, 0.0));
-        //double valuer = std::abs(ff.evaluate(q,q0_bin, 0.0, 0.0));
-        //double valuei = std::abs(ff.evaluate(q,q0_bin, 0.0, 0.0));
+        Bin1D zero_bin = { 0.0, 0.0 };
+        double value = std::abs(ff.evaluate(q,q0_bin, zero_bin));
+        //double valuep = std::abs(ff.evaluate(q,q0_bin, zero_bin));
+        //double valuer = std::abs(ff.evaluate(q,q0_bin, zero_bin));
+        //double valuei = std::abs(ff.evaluate(q,q0_bin, zero_bin));
 
         vh2_xy->Fill(x,y,value);
 
diff --git a/App/src/TestPolarizedDWBA.cpp b/App/src/TestPolarizedDWBA.cpp
index b40f1e10454ce2c162e6de46babc739a176cb1ff..6357f331a006e27e8a5cfab3c4ba43ea508697a1 100644
--- a/App/src/TestPolarizedDWBA.cpp
+++ b/App/src/TestPolarizedDWBA.cpp
@@ -42,7 +42,7 @@ void TestPolarizedDWBA::execute()
         0.0*Units::degree, 2.0*Units::degree, true);
     simulation.setBeamParameters(
         1.0*Units::angstrom, 0.2*Units::degree, 0.0*Units::degree);
-    simulation.setBeamIntensity(8e12);
+    simulation.setBeamIntensity(1e7);
 
     // Run simulation
     simulation.setSample(*mp_sample);
diff --git a/App/src/TestPolarizedDWBATerms.cpp b/App/src/TestPolarizedDWBATerms.cpp
index 056fc133a837de84e4353dd52688cf68380d2b7b..7c94425db7d7d4abba3eade5eb02a90c3fe12c3f 100644
--- a/App/src/TestPolarizedDWBATerms.cpp
+++ b/App/src/TestPolarizedDWBATerms.cpp
@@ -16,6 +16,7 @@
 #include "TestPolarizedDWBATerms.h"
 
 #include "FormFactorDWBAPol.h"
+#include "FormFactorDecoratorMaterial.h"
 #include "FormFactorDWBA.h"
 #include "FormFactorCylinder.h"
 #include "LayerSpecularInfo.h"
@@ -30,29 +31,31 @@ TestPolarizedDWBATerms::TestPolarizedDWBATerms()
 , m_alpha_i(0.15)
 , m_alpha_f(0.1)
 {
-    mp_matrix_ff = new FormFactorDWBAPol(new FormFactorCylinder(
-            1.0, 1.0));
-    mp_scalar_ff = new FormFactorDWBA(new FormFactorCylinder(
-            1.0, 1.0));
-    mp_specular_info = new LayerSpecularInfo();
-    initSpecularInfo();
-    mp_matrix_ff->setSpecularInfo(*mp_specular_info);
-    mp_scalar_ff->setSpecularInfo(*mp_specular_info);
+    initWavevectors();
     const IMaterial *p_particle_material =
             MaterialManager::getHomogeneousMaterial(
             "particle", complex_t(1.0, 0.0));
     const IMaterial *p_ambient_material =
             MaterialManager::getHomogeneousMaterial(
             "ambient", complex_t(0.0, 0.0));
-    mp_matrix_ff->setMaterial(p_particle_material);
-    mp_matrix_ff->setAmbientMaterial(p_ambient_material);
+    FormFactorDecoratorMaterial *p_material_ff =
+            new FormFactorDecoratorMaterial(new FormFactorCylinder(1.0, 1.0));
+    p_material_ff->setMaterial(p_particle_material);
+    p_material_ff->setAmbientMaterial(p_ambient_material);
+    mp_matrix_ff = new FormFactorDWBAPol(p_material_ff);
+    mp_scalar_ff = new FormFactorDWBA(p_material_ff->clone());
+    mp_specular_info = new LayerSpecularInfo();
+    initSpecularInfo();
+    mp_matrix_ff->setSpecularInfo(*mp_specular_info);
+    mp_scalar_ff->setSpecularInfo(*mp_specular_info);
 }
 
 void TestPolarizedDWBATerms::execute()
 {
-    mp_scalar_ff->calculateTerms(m_ki, m_kf_bin, m_alpha_i, m_alpha_f);
-    mp_matrix_ff->calculateTerms(m_ki, m_kf_bin, m_kf_bin, m_alpha_i, m_alpha_f,
-            0.1);
+    Bin1D alpha_f_bin = { m_alpha_f, m_alpha_f };
+    Bin1D zero_bin = { 0.0, 0.0 };
+    mp_scalar_ff->calculateTerms(m_ki, m_kf_bin, alpha_f_bin);
+    mp_matrix_ff->calculateTerms(m_ki, m_kf_bin, alpha_f_bin, zero_bin);
 
     std::cout << mp_scalar_ff->m_term_SR << std::endl;
 
@@ -66,8 +69,8 @@ void TestPolarizedDWBATerms::initWavevectors()
 {
     m_ki.setLambdaAlphaPhi(0.21, -m_alpha_i, 0.0);
 
-    Bin1D alpha_bin = { 0.99, 1.01 };
-    Bin1D phi_bin = {0.99, 1.01 };
+    Bin1D alpha_bin = { m_alpha_f, m_alpha_f };
+    Bin1D phi_bin = { 0.0, 0.0 };
     m_kf_bin = Bin1DCVector(0.21, alpha_bin, phi_bin);
 }
 
@@ -81,7 +84,7 @@ void TestPolarizedDWBATerms::initSpecularInfo()
     rt_coeffs.lambda = complex_t(0.1, 0.001);
     rt_coeffs.kz = 30.0*rt_coeffs.lambda;
     rt_coeffs.phi_psi << complex_t(-0.2, 0.001), complex_t(0.9, 0.001);
-    p_coeff_map->addCoefficients(rt_coeffs, m_alpha_f, 0.1);
+    p_coeff_map->addCoefficients(rt_coeffs, m_alpha_f, 0.0);
 
     rt_coeffs.lambda = complex_t(0.2, 0.003);
     rt_coeffs.kz = -m_ki.z();
diff --git a/Core/Algorithms/inc/Beam.h b/Core/Algorithms/inc/Beam.h
index 4df14476bf3909a5ff32774a54b5b3a02c0ca608..b005ce9590ee721ce2eb0fca6dcdc66d24fbf494 100644
--- a/Core/Algorithms/inc/Beam.h
+++ b/Core/Algorithms/inc/Beam.h
@@ -34,7 +34,7 @@
 
 class BA_CORE_API_ Beam : public IParameterized
 {
- public:
+public:
 #ifndef GCCXML_SKIP_THIS
     EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 #endif
@@ -81,11 +81,11 @@ class BA_CORE_API_ Beam : public IParameterized
     bool checkPolarization(const Eigen::Matrix2cd &polarization) const;
 #endif
 
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 
- private:
+private:
     //! swap function
     void swapContent(Beam& other);
 
diff --git a/Core/Algorithms/inc/ChiSquaredFrequency.h b/Core/Algorithms/inc/ChiSquaredFrequency.h
index e30a5c355d2b1f3ca5ce302d4f68baaf95c6e5cf..f20e14b34d0c1eb9a8f8efc2295f72e209d1a6d4 100644
--- a/Core/Algorithms/inc/ChiSquaredFrequency.h
+++ b/Core/Algorithms/inc/ChiSquaredFrequency.h
@@ -22,7 +22,7 @@
 
 class ChiSquaredFrequency : public IChiSquaredModule
 {
- public:
+public:
     ChiSquaredFrequency()
         : mp_real_ft(0) , mp_simulation_ft(0) , m_cutoff(1.0) {}
     virtual ~ChiSquaredFrequency()
@@ -40,7 +40,7 @@ class ChiSquaredFrequency : public IChiSquaredModule
 
     //! Returns output data which contains chi^2 values
     virtual OutputData<double > *createChi2DifferenceMap() const;
- protected:
+protected:
     virtual void initWeights();
     OutputData<complex_t> *mp_real_ft;
     OutputData<complex_t> *mp_simulation_ft;
diff --git a/Core/Algorithms/inc/ChiSquaredModule.h b/Core/Algorithms/inc/ChiSquaredModule.h
index 3370cfdb324d7e336d55cd43446ef4ff9cdfa50b..d5559e4719265c16559203ca4d730baa06261dc2 100644
--- a/Core/Algorithms/inc/ChiSquaredModule.h
+++ b/Core/Algorithms/inc/ChiSquaredModule.h
@@ -20,7 +20,7 @@
 
 class BA_CORE_API_ ChiSquaredModule : public IChiSquaredModule
 {
- public:
+public:
     ChiSquaredModule() {}
     ChiSquaredModule(const ChiSquaredModule& other)
         : IChiSquaredModule(other) {}
diff --git a/Core/Algorithms/inc/ConvolutionDetectorResolution.h b/Core/Algorithms/inc/ConvolutionDetectorResolution.h
index a6c0e4e987e309bc7f9dfb7278f7196707b558d2..47537d83de2309387230e5f5b67428ada78a365c 100644
--- a/Core/Algorithms/inc/ConvolutionDetectorResolution.h
+++ b/Core/Algorithms/inc/ConvolutionDetectorResolution.h
@@ -26,7 +26,7 @@
 
 class BA_CORE_API_ ConvolutionDetectorResolution : public IDetectorResolution
 {
- public:
+public:
     typedef double (*cumulative_DF_1d)(double);
     //! Constructor taking a 1 dimensional resolution function as argument
     ConvolutionDetectorResolution(cumulative_DF_1d res_function_1d);
@@ -47,12 +47,12 @@ class BA_CORE_API_ ConvolutionDetectorResolution : public IDetectorResolution
     //! clone object
     virtual ConvolutionDetectorResolution *clone() const;
 
- protected:
+protected:
     ConvolutionDetectorResolution(const ConvolutionDetectorResolution& other);
 
     virtual void init_parameters();
 
- private:
+private:
     void apply1dConvolution(OutputData<double> *p_intensity_map) const;
     void apply2dConvolution(OutputData<double> *p_intensity_map) const;
     double getIntegratedPDF1d(double x, double step) const;
diff --git a/Core/Algorithms/inc/DWBADiffuseReflection.h b/Core/Algorithms/inc/DWBADiffuseReflection.h
index cd0515f55eccd96297897eb0a682488222de215e..e2b281ee18f0c29de9ad2b305805fad3946dc93d 100644
--- a/Core/Algorithms/inc/DWBADiffuseReflection.h
+++ b/Core/Algorithms/inc/DWBADiffuseReflection.h
@@ -25,7 +25,7 @@
 
 class DWBADiffuseReflection : public ISimulation
 {
- public:
+public:
     DWBADiffuseReflection();
 
     void execute(const MultiLayer& sample,
@@ -39,7 +39,7 @@ class DWBADiffuseReflection : public ISimulation
 
     void setKvectors(const kvector_t& ki, const kvector_t& kf);
 
- private:
+private:
     void diffuse_autocorr();
 
     void diffuse_crosscorr();
diff --git a/Core/Algorithms/inc/DWBASimulation.h b/Core/Algorithms/inc/DWBASimulation.h
index 2bdb79c9b32d1001ad09588624d9e00cd3eadaf7..8c6b77fe8356243357534844ce08307828eb652f 100644
--- a/Core/Algorithms/inc/DWBASimulation.h
+++ b/Core/Algorithms/inc/DWBASimulation.h
@@ -30,7 +30,7 @@
 
 class DWBASimulation : public ISimulation
 {
- public:
+public:
     DWBASimulation();
 
     virtual ~DWBASimulation();
diff --git a/Core/Algorithms/inc/DecouplingApproximationStrategy.h b/Core/Algorithms/inc/DecouplingApproximationStrategy.h
index cec7afb58903d51bafa6653ca5ef7584977b9b9a..a8d72cf3a44fe3ff450e2b44ed3ccf09c05a8d7e 100644
--- a/Core/Algorithms/inc/DecouplingApproximationStrategy.h
+++ b/Core/Algorithms/inc/DecouplingApproximationStrategy.h
@@ -30,14 +30,12 @@ public:
     virtual void init(
         const SafePointerVector<FormFactorInfo>& form_factor_infos,
         const SafePointerVector<IInterferenceFunction>& ifs);
-    virtual double evaluate(
-        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-        double alpha_i, double alpha_f) const;
+    virtual double evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
+            Bin1D alpha_f_bin) const;
 
     //! Calculates and returns a polarized form factor in DWBA
     virtual Eigen::Matrix2d evaluatePol(const cvector_t& k_i,
-            const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-            double alpha_i, double alpha_f, double phi_f) const;
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin, Bin1D phi_f_bin) const;
 
 private:
     bool checkVectorSizes() const;
diff --git a/Core/Algorithms/inc/Detector.h b/Core/Algorithms/inc/Detector.h
index 81e981240bf00e64e4b721f5934c4af676afe3ee..d635437103521593cd5b4176997835881ad78dbd 100644
--- a/Core/Algorithms/inc/Detector.h
+++ b/Core/Algorithms/inc/Detector.h
@@ -24,7 +24,7 @@
 
 class BA_CORE_API_ Detector : public IParameterized
 {
- public:
+public:
 
     Detector();
     Detector(const Detector& other);
@@ -66,7 +66,7 @@ class BA_CORE_API_ Detector : public IParameterized
     //! Normalize intensity data with detector cell sizes.
     void normalize(OutputData<double> *p_data, double sin_alpha_i) const;
 
- protected:
+protected:
 
     //! Registers some class members for later access via parameter pool.
     virtual void init_parameters() {}
@@ -77,7 +77,7 @@ class BA_CORE_API_ Detector : public IParameterized
     //! Checks if data has a compatible format with the detector.
     bool dataShapeMatches(const OutputData<double> *p_data) const;
 
- private:
+private:
 
     //! swap function
     void swapContent(Detector& other);
diff --git a/Core/Algorithms/inc/DiffuseDWBASimulation.h b/Core/Algorithms/inc/DiffuseDWBASimulation.h
index 10be72f28ce38503cb32bf3f23b276a0cffa2229..ee2a768e0207ce5224f92d5579421bdce638f5af 100644
--- a/Core/Algorithms/inc/DiffuseDWBASimulation.h
+++ b/Core/Algorithms/inc/DiffuseDWBASimulation.h
@@ -21,7 +21,7 @@
 
 class DiffuseDWBASimulation: public LayerDWBASimulation
 {
- public:
+public:
     DiffuseDWBASimulation()
         : m_refractive_index(1., 0.), m_surface_density(1.) {}
 
@@ -45,7 +45,7 @@ class DiffuseDWBASimulation: public LayerDWBASimulation
             m_np_infos[np_index]->scaleAbundance(factor);
     }
 
- protected:
+protected:
     complex_t m_refractive_index;
     double m_surface_density;
     SafePointerVector<DiffuseParticleInfo> m_np_infos;
@@ -63,7 +63,8 @@ class DiffuseDWBASimulation: public LayerDWBASimulation
     };
     void initDiffuseFormFactorTerms(
         std::vector<DiffuseFormFactorTerm *>& terms,
-        size_t nbr_heights, size_t samples_per_particle);
+        size_t nbr_heights, size_t samples_per_particle,
+        complex_t wavevector_scattering_factor);
 };
 
 #endif /* DIFFUSEDWBASIMULATION_H_ */
diff --git a/Core/Algorithms/inc/FTDistributions.h b/Core/Algorithms/inc/FTDistributions.h
index d7ccbb1e4754920b17d89f375720089f1e7f8b30..31cd7cc09817142e3268043ead1d9ca92471c44b 100644
--- a/Core/Algorithms/inc/FTDistributions.h
+++ b/Core/Algorithms/inc/FTDistributions.h
@@ -24,18 +24,18 @@
 
 class IFTDistribution1D
 {
- public:
+public:
     IFTDistribution1D(double omega) : m_omega(omega) {}
     virtual ~IFTDistribution1D() {}
 
     virtual double evaluate(double q) const=0;
- protected:
+protected:
     double m_omega;
 };
 
 class BA_CORE_API_ IFTDistribution2D : public IParameterized
 {
- public:
+public:
     IFTDistribution2D(double omega_x, double omega_y)
         : m_omega_x(omega_x)
         , m_omega_y(omega_y)
@@ -60,7 +60,7 @@ class BA_CORE_API_ IFTDistribution2D : public IParameterized
     //! transform back to a*, b* basis:
     virtual void transformToStarBasis(double qX, double qY,
             double alpha, double a, double b, double& qa, double& qb) const=0;
- protected:
+protected:
     double m_omega_x;
     double m_omega_y;
     double m_gamma;
@@ -69,7 +69,7 @@ class BA_CORE_API_ IFTDistribution2D : public IParameterized
 
 class BA_CORE_API_ FTDistribution2DCauchy : public IFTDistribution2D
 {
- public:
+public:
     FTDistribution2DCauchy(double omega_x, double omega_y);
     virtual ~FTDistribution2DCauchy() {}
 
@@ -79,7 +79,7 @@ class BA_CORE_API_ FTDistribution2DCauchy : public IFTDistribution2D
 
     virtual void transformToStarBasis(double qX, double qY,
             double alpha, double a, double b, double& qa, double& qb) const;
- protected:
+protected:
     virtual void init_parameters();
 };
 
diff --git a/Core/Algorithms/inc/IChiSquaredModule.h b/Core/Algorithms/inc/IChiSquaredModule.h
index a18caa5f8f90d44f2969827086454b0b1c94b3fb..34a7ba2fc942b4321f1c95821fd2f246efdd5f2d 100644
--- a/Core/Algorithms/inc/IChiSquaredModule.h
+++ b/Core/Algorithms/inc/IChiSquaredModule.h
@@ -25,7 +25,7 @@
 
 class BA_CORE_API_ IChiSquaredModule : public ICloneable
 {
- public:
+public:
     IChiSquaredModule();
     virtual ~IChiSquaredModule();
 
@@ -95,7 +95,7 @@ class BA_CORE_API_ IChiSquaredModule : public ICloneable
             "IChiSquaredModule::getResidualValue() -> "
             "Error! Not implemented."); }
 
- protected:
+protected:
     IChiSquaredModule(const IChiSquaredModule& other);
 
     virtual void initWeights();
diff --git a/Core/Algorithms/inc/IDetectorResolution.h b/Core/Algorithms/inc/IDetectorResolution.h
index 2758cf90e07ef5353c73ba89168fab99374ec726..1de352258a48124142d8f85a7baae6cbbd9bb35b 100644
--- a/Core/Algorithms/inc/IDetectorResolution.h
+++ b/Core/Algorithms/inc/IDetectorResolution.h
@@ -22,7 +22,7 @@
 
 class BA_CORE_API_ IDetectorResolution : public ICloneable, public IParameterized
 {
- public:
+public:
     virtual ~IDetectorResolution() {}
     //! Apply the resolution function to the intensity data
     virtual void applyDetectorResolution(OutputData<double> *p_intensity_map) const=0;
diff --git a/Core/Algorithms/inc/IFittingDataSelector.h b/Core/Algorithms/inc/IFittingDataSelector.h
index 3a04401006e0eabadc94b55c5e17333ce3d10d08..4da703c0d5a16f12585eb71d76799e71fb7c4b17 100644
--- a/Core/Algorithms/inc/IFittingDataSelector.h
+++ b/Core/Algorithms/inc/IFittingDataSelector.h
@@ -20,7 +20,7 @@
 
 class IFittingDataSelector
 {
- public:
+public:
     virtual ~IFittingDataSelector() {}
     virtual IFittingDataSelector *clone() const=0;
 
@@ -31,7 +31,7 @@ class IFittingDataSelector
 
 class DefaultAllDataSelector : public IFittingDataSelector
 {
- public:
+public:
     DefaultAllDataSelector() {}
     virtual ~DefaultAllDataSelector() {}
     virtual DefaultAllDataSelector *clone() const {
diff --git a/Core/Algorithms/inc/IIntensityFunction.h b/Core/Algorithms/inc/IIntensityFunction.h
index 7e4c2854b86d5b1e258f9675b059da8054f60213..0efaa6707accd1e663e8986507cfa698227a892a 100644
--- a/Core/Algorithms/inc/IIntensityFunction.h
+++ b/Core/Algorithms/inc/IIntensityFunction.h
@@ -21,7 +21,7 @@
 
 class IIntensityFunction
 {
- public:
+public:
     virtual ~IIntensityFunction() {}
     virtual IIntensityFunction *clone() const=0;
 
@@ -30,7 +30,7 @@ class IIntensityFunction
 
 class IntensityFunctionLog : public IIntensityFunction
 {
- public:
+public:
     virtual ~IntensityFunctionLog() {}
     virtual IntensityFunctionLog *clone() const {
         return new IntensityFunctionLog(); }
@@ -40,7 +40,7 @@ class IntensityFunctionLog : public IIntensityFunction
 
 class IntensityFunctionSqrt : public IIntensityFunction
 {
- public:
+public:
     virtual ~IntensityFunctionSqrt() {}
     virtual IntensityFunctionSqrt *clone() const {
         return new IntensityFunctionSqrt(); }
diff --git a/Core/Algorithms/inc/IInterferenceFunctionStrategy.h b/Core/Algorithms/inc/IInterferenceFunctionStrategy.h
index 8fac942d3af5521ae0f0fc2ad5083c0254372cc1..34297e7ef0ef8a8a8c9e145013c7b8b3859e48f7 100644
--- a/Core/Algorithms/inc/IInterferenceFunctionStrategy.h
+++ b/Core/Algorithms/inc/IInterferenceFunctionStrategy.h
@@ -35,19 +35,19 @@ public:
                       form_factor_infos,
                       const SafePointerVector<IInterferenceFunction>& ifs);
     virtual double evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-            double alpha_i, double alpha_f) const=0;
+            Bin1D alpha_f_bin) const=0;
     //! Calculates and returns a polarized form factor in DWBA
     virtual Eigen::Matrix2d evaluatePol(const cvector_t& k_i,
-            const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-            double alpha_i, double alpha_f, double phi_f) const=0;
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const=0;
 
 protected:
     //! Returns mean form factor, possibly including their position information
     complex_t meanFormFactor(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-            double alpha_i, double alpha_f, bool use_position=false) const;
+            Bin1D alpha_f_bin, bool use_position=false) const;
     //! Returns mean squared form factor
-    double meanSquaredFormFactor(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-            double alpha_i, double alpha_f) const;
+    double meanSquaredFormFactor(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
     //! Returns q-vector from k_i and the bin of k_f
     cvector_t getQ(const cvector_t& k_i, const Bin1DCVector& k_f_bin) const;
     SafePointerVector<FormFactorInfo> m_ff_infos; //!< form factor info
@@ -63,15 +63,16 @@ inline void IInterferenceFunctionStrategy::init(
     m_ifs = ifs;
 }
 
-inline complex_t IInterferenceFunctionStrategy::meanFormFactor(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f, bool use_position) const
+inline complex_t IInterferenceFunctionStrategy::meanFormFactor(
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+        bool use_position) const
 {
     complex_t result;
     for (SafePointerVector<FormFactorInfo>::const_iterator
              it=m_ff_infos.begin();
          it != m_ff_infos.end(); ++it) {
         complex_t ff_value =
-            (*it)->mp_ff->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+            (*it)->mp_ff->evaluate(k_i, k_f_bin, alpha_f_bin);
         if (use_position) {
             cvector_t q = getQ(k_i, k_f_bin);
             complex_t phase = q.x()*(*it)->m_pos_x + q.y()*(*it)->m_pos_y;
@@ -83,13 +84,12 @@ inline complex_t IInterferenceFunctionStrategy::meanFormFactor(const cvector_t&
 }
 
 inline double IInterferenceFunctionStrategy::meanSquaredFormFactor(
-    const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-    double alpha_i, double alpha_f) const
+    const cvector_t& k_i, const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
     double result=0.0;
-    for (SafePointerVector<FormFactorInfo>::const_iterator it=m_ff_infos.begin();
-            it != m_ff_infos.end(); ++it) {
-        complex_t ff_value = (*it)->mp_ff->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+    for (SafePointerVector<FormFactorInfo>::const_iterator it =
+            m_ff_infos.begin(); it != m_ff_infos.end(); ++it) {
+        complex_t ff_value = (*it)->mp_ff->evaluate(k_i, k_f_bin, alpha_f_bin);
         result += std::norm(ff_value);
     }
     return result;
diff --git a/Core/Algorithms/inc/IOutputDataNormalizer.h b/Core/Algorithms/inc/IOutputDataNormalizer.h
index 5929f4c6b3bef1a1b81cb2a1dd0c74be145ea342..35ceae9dfd6d733c812f5b9b0ce81bd22c9f97f4 100644
--- a/Core/Algorithms/inc/IOutputDataNormalizer.h
+++ b/Core/Algorithms/inc/IOutputDataNormalizer.h
@@ -24,7 +24,7 @@
 
 class BA_CORE_API_ IOutputDataNormalizer : public IParameterized
 {
- public:
+public:
     virtual ~IOutputDataNormalizer() {}
 
     virtual IOutputDataNormalizer*clone() const=0;
@@ -39,7 +39,7 @@ class BA_CORE_API_ IOutputDataNormalizer : public IParameterized
 
 class BA_CORE_API_ OutputDataNormalizer : public IOutputDataNormalizer
 {
- public:
+public:
     OutputDataNormalizer(double scale=1.0, double shift=0.0)
         : m_scale(scale), m_shift(shift), m_max_intensity(0.0)
     {
@@ -56,7 +56,7 @@ class BA_CORE_API_ OutputDataNormalizer : public IOutputDataNormalizer
     virtual void setMaximumIntensity(double max_intensity) {
         m_max_intensity = max_intensity; }
 
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 
@@ -69,7 +69,7 @@ class BA_CORE_API_ OutputDataNormalizer : public IOutputDataNormalizer
 
 class OutputDataSimpleNormalizer : public OutputDataNormalizer
 {
- public:
+public:
     OutputDataSimpleNormalizer(double scale=1.0, double shift=0.0)
     : OutputDataNormalizer(scale, shift) { m_max_intensity = 1.0; }
 
diff --git a/Core/Algorithms/inc/IResolutionFunction2D.h b/Core/Algorithms/inc/IResolutionFunction2D.h
index 8e7ffad7c9b5a544e113ca617f26f2c11af5d858..28b5288d1989e4b3bb45c8abd0674ccff63572b9 100644
--- a/Core/Algorithms/inc/IResolutionFunction2D.h
+++ b/Core/Algorithms/inc/IResolutionFunction2D.h
@@ -22,7 +22,7 @@
 
 class BA_CORE_API_ IResolutionFunction2D : public IParameterized
 {
- public:
+public:
     virtual ~IResolutionFunction2D() {}
 
     virtual double evaluateCDF(double x, double y) const=0;
diff --git a/Core/Algorithms/inc/ISampleBuilder.h b/Core/Algorithms/inc/ISampleBuilder.h
index 0679de9f83c00d99f7d84e228056c005a2bc8827..6b718cdc6b829546d941fc48304f6d81c3747ff6 100644
--- a/Core/Algorithms/inc/ISampleBuilder.h
+++ b/Core/Algorithms/inc/ISampleBuilder.h
@@ -20,13 +20,13 @@
 
 class BA_CORE_API_ ISampleBuilder : public IParameterized
 {
- public:
+public:
     ISampleBuilder() { setName("SampleBuilder"); }
     virtual ~ISampleBuilder() {}
 
     virtual ISample *buildSample() const {
         throw NotImplementedException("ISampleBuilder::buildSample() -> Not implemented"); }
- protected:
+protected:
 };
 
 #endif /* ISAMPLEBUILDER_H_ */
diff --git a/Core/Algorithms/inc/ISimulation.h b/Core/Algorithms/inc/ISimulation.h
index 2cb10b0fd5fbbf7a7fb6f62be578db1c7bd099c6..e0de030456814074b4fc5b7a72b570bbd5b99e05 100644
--- a/Core/Algorithms/inc/ISimulation.h
+++ b/Core/Algorithms/inc/ISimulation.h
@@ -22,7 +22,7 @@
 
 class ISimulation : public ICloneable
 {
- public:
+public:
     virtual ~ISimulation() {}
     ISimulation *clone() const
     {
diff --git a/Core/Algorithms/inc/ISquaredFunction.h b/Core/Algorithms/inc/ISquaredFunction.h
index f8f274cbdbb87b567a8ff4db0eb544507ee0df1a..ae07fa186190ba3a846981f9ab8cb605a4d98acf 100644
--- a/Core/Algorithms/inc/ISquaredFunction.h
+++ b/Core/Algorithms/inc/ISquaredFunction.h
@@ -25,7 +25,7 @@
 
 class ISquaredFunction
 {
- public:
+public:
     virtual ~ISquaredFunction() {}
     virtual ISquaredFunction *clone() const=0;
 
@@ -45,7 +45,7 @@ class ISquaredFunction
 
 class SquaredFunctionDefault : public ISquaredFunction
 {
- public:
+public:
     SquaredFunctionDefault() {}
     virtual ~SquaredFunctionDefault() {}
     virtual SquaredFunctionDefault *clone() const { return new SquaredFunctionDefault(); }
@@ -71,7 +71,7 @@ class SquaredFunctionDefault : public ISquaredFunction
 
 class SquaredFunctionWhichOnlyWorks : public ISquaredFunction
 {
- public:
+public:
     SquaredFunctionWhichOnlyWorks() {}
     virtual ~SquaredFunctionWhichOnlyWorks() {}
     virtual SquaredFunctionWhichOnlyWorks *clone() const { return new SquaredFunctionWhichOnlyWorks(*this); }
@@ -94,7 +94,7 @@ class SquaredFunctionWhichOnlyWorks : public ISquaredFunction
 
 class SquaredFunctionWithSystematicError : public ISquaredFunction
 {
- public:
+public:
     SquaredFunctionWithSystematicError(double epsilon = 0.08) : m_epsilon(epsilon){}
     virtual ~SquaredFunctionWithSystematicError() {}
     virtual SquaredFunctionWithSystematicError *clone() const { return new SquaredFunctionWithSystematicError(*this); }
@@ -110,7 +110,7 @@ class SquaredFunctionWithSystematicError : public ISquaredFunction
         return std::max(std::fabs(real_value) + (m_epsilon*real_value)*(m_epsilon*real_value),1.0);
     }
 
- private:
+private:
     double m_epsilon;
 };
 
@@ -118,7 +118,7 @@ class SquaredFunctionWithSystematicError : public ISquaredFunction
 
 class SquaredFunctionWithGaussianError : public ISquaredFunction
 {
- public:
+public:
     SquaredFunctionWithGaussianError(double sigma = 0.01) : m_sigma(sigma){}
     virtual ~SquaredFunctionWithGaussianError() {}
     virtual SquaredFunctionWithGaussianError *clone() const { return new SquaredFunctionWithGaussianError(*this); }
@@ -134,7 +134,7 @@ class SquaredFunctionWithGaussianError : public ISquaredFunction
         return m_sigma*m_sigma;
     }
 
- private:
+private:
     double m_sigma;
 };
 
diff --git a/Core/Algorithms/inc/Instrument.h b/Core/Algorithms/inc/Instrument.h
index 27199c13ee613d5eff40d72da04594bd92de2e14..bfbefe03aad83c4662ece3cd968ce44f4cb4f807 100644
--- a/Core/Algorithms/inc/Instrument.h
+++ b/Core/Algorithms/inc/Instrument.h
@@ -24,7 +24,7 @@
 
 class BA_CORE_API_ Instrument : public IParameterized
 {
- public:
+public:
     Instrument();
     Instrument(const Instrument& other);
 
@@ -80,7 +80,7 @@ class BA_CORE_API_ Instrument : public IParameterized
             OutputData<Eigen::Matrix2d> *p_polarized_intensity = 0) const;
 #endif
 
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 
diff --git a/Core/Algorithms/inc/IsGISAXSMorphologyFileStrategy.h b/Core/Algorithms/inc/IsGISAXSMorphologyFileStrategy.h
index fe03be17b0b29a4e952efc0b1e595eb848514689..90967e4a2a1632fe6fd4ea32aa2ec53963500599 100644
--- a/Core/Algorithms/inc/IsGISAXSMorphologyFileStrategy.h
+++ b/Core/Algorithms/inc/IsGISAXSMorphologyFileStrategy.h
@@ -19,7 +19,8 @@
 #include "Types.h"
 #include "IInterferenceFunctionStrategy.h"
 
-//! Definition of interference function strategy that emulates the behaviour of IsGISAXS for morphology files
+//! Definition of interference function strategy that emulates the behaviour of
+//! IsGISAXS for morphology files
 
 class IsGISAXSMorphologyFileStrategy : public IInterferenceFunctionStrategy
 {
@@ -30,12 +31,12 @@ public:
     virtual void init(const SafePointerVector<FormFactorInfo>& form_factor_infos,
             const SafePointerVector<IInterferenceFunction>& ifs);
     virtual double evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-            double alpha_i, double alpha_f) const;
+            Bin1D alpha_f_bin) const;
 
     //! Calculates and returns a polarized form factor in DWBA
     virtual Eigen::Matrix2d evaluatePol(const cvector_t& k_i,
-            const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-            double alpha_i, double alpha_f, double phi_f) const;
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
 private:
     void initPositions();
     bool checkVectorSizes();
diff --git a/Core/Algorithms/inc/LayerStrategyBuilder.h b/Core/Algorithms/inc/LayerStrategyBuilder.h
index eea3632fe7bf6f4443455449e75609f2b25e1a94..0cefcbb7323681a06a9b17c190f6c6cf14f47578 100644
--- a/Core/Algorithms/inc/LayerStrategyBuilder.h
+++ b/Core/Algorithms/inc/LayerStrategyBuilder.h
@@ -70,11 +70,12 @@ private:
         const ParticleInfo *p_particle_info,
         const IMaterial *p_ambient_material,
         complex_t factor) const;
-    //! Creates formfactor info for single particle in presence of polarization
-    FormFactorInfo *createFormFactorInfoPol(
-        const ParticleInfo *p_particle_info,
-        const IMaterial *p_ambient_material,
-        complex_t factor) const;
+    //! Decorates the given formfactor with a scalar dwba formfactor
+    IFormFactor *createDWBAScalarFormFactor(IFormFactor *p_form_factor,
+            double depth) const;
+    //! Decorates the given formfactor with a matrix dwba formfactor
+    IFormFactor *createDWBAMatrixFormFactor(IFormFactor *p_form_factor,
+            double depth) const;
 
     SafePointerVector<FormFactorInfo> m_ff_infos;
     SafePointerVector<IInterferenceFunction> m_ifs;
diff --git a/Core/Algorithms/inc/LocalMonodisperseApproximationStrategy.h b/Core/Algorithms/inc/LocalMonodisperseApproximationStrategy.h
index f17c2078bad75105812caa880c129d6569342267..891a8b3bdec6cf39dcd16dd806d0aea8fcba85b9 100644
--- a/Core/Algorithms/inc/LocalMonodisperseApproximationStrategy.h
+++ b/Core/Algorithms/inc/LocalMonodisperseApproximationStrategy.h
@@ -20,7 +20,8 @@
 
 //! ?
 
-class LocalMonodisperseApproximationStrategy : public IInterferenceFunctionStrategy
+class LocalMonodisperseApproximationStrategy :
+                                      public IInterferenceFunctionStrategy
 {
 public:
     LocalMonodisperseApproximationStrategy(SimulationParameters sim_params);
@@ -29,12 +30,12 @@ public:
     virtual void init(const SafePointerVector<FormFactorInfo>& form_factor_infos,
             const SafePointerVector<IInterferenceFunction>& ifs);
     virtual double evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-            double alpha_i, double alpha_f) const;
+            Bin1D alpha_f_bin) const;
 
     //! Calculates and returns a polarized form factor in DWBA
     virtual Eigen::Matrix2d evaluatePol(const cvector_t& k_i,
-            const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-            double alpha_i, double alpha_f, double phi_f) const;
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
 private:
     bool checkVectorSizes();
 };
diff --git a/Core/Algorithms/inc/Mask.h b/Core/Algorithms/inc/Mask.h
index b1db5a56438ddf77d0b84b6b6b19aa39ecc6676d..ae31f434d9a9391e37401490706330c62aaf5c42 100644
--- a/Core/Algorithms/inc/Mask.h
+++ b/Core/Algorithms/inc/Mask.h
@@ -22,7 +22,7 @@
 
 class BA_CORE_API_ Mask : public ICloneable
 {
- public:
+public:
     template <class TValue, class TContainer> friend class OutputDataIterator;
     template <class TValue> friend class OutputData;
     explicit Mask(Mask *p_submask=0)
@@ -37,12 +37,12 @@ class BA_CORE_API_ Mask : public ICloneable
     size_t getOwnIndex() const { return m_own_index; }
     size_t getMaxIndex() const { return m_max_index; }
 
- protected:
+protected:
     virtual bool isMasked(size_t total_index) const;
     size_t m_own_index;
     size_t m_max_index;
     Mask *mp_submask;
- private:
+private:
     size_t nextSubIndex(size_t total_index);
 };
 
@@ -50,16 +50,16 @@ class BA_CORE_API_ Mask : public ICloneable
 
 class BA_CORE_API_ MaskIndexModulus : public Mask
 {
- public:
+public:
     MaskIndexModulus(size_t modulus, size_t remainder, Mask *p_submask=0)
         : Mask(p_submask), m_modulus(modulus), m_remainder(remainder) {}
     virtual ~MaskIndexModulus() {}
     virtual MaskIndexModulus *clone() const;
 
- protected:
+protected:
     virtual bool isMasked(size_t total_index) const;
 
- private:
+private:
     size_t m_modulus;
     size_t m_remainder;
 };
@@ -68,17 +68,17 @@ class BA_CORE_API_ MaskIndexModulus : public Mask
 
 class BA_CORE_API_ MaskCoordinates : public Mask
 {
- public:
+public:
     MaskCoordinates(size_t rank, const int *dims, Mask *p_submask=0);
     virtual ~MaskCoordinates();
     virtual MaskCoordinates *clone() const;
 
     void setMaskCoordinateFunction(MaskCoordinateFunction *p_mask_function);
 
- protected:
+protected:
     virtual bool isMasked(size_t total_index) const;
 
- private:
+private:
     void setCachedCoordinates(size_t index) const;
     size_t m_rank;
     int *m_dims;
diff --git a/Core/Algorithms/inc/MaskCoordinateFunction.h b/Core/Algorithms/inc/MaskCoordinateFunction.h
index 7a568cfeb443a5fe7fb2830a77d2a56aacdce3ba..2d925abc9194c7bf0536d2882ccdd3d86c340dd6 100644
--- a/Core/Algorithms/inc/MaskCoordinateFunction.h
+++ b/Core/Algorithms/inc/MaskCoordinateFunction.h
@@ -24,14 +24,14 @@
 
 class BA_CORE_API_ MaskCoordinateFunction : public ICloneable
 {
- public:
+public:
     MaskCoordinateFunction(size_t rank);
     virtual MaskCoordinateFunction *clone() const;
     virtual ~MaskCoordinateFunction() {}
 
     bool isMasked(size_t rank, const int *coordinates) const;
     void setInvertFlag(bool invert) { m_invert = invert; }
- protected:
+protected:
     virtual bool isInStandardMaskedArea(const int *coordinates) const;
     size_t m_rank;
     bool m_invert;  //!< if true, the complement is masked instead
@@ -41,15 +41,15 @@ class BA_CORE_API_ MaskCoordinateFunction : public ICloneable
 
 class BA_CORE_API_ MaskCoordinateRectangleFunction : public MaskCoordinateFunction
 {
- public:
+public:
     MaskCoordinateRectangleFunction(size_t rank, const int *minima, const int *maxima);
     virtual MaskCoordinateRectangleFunction *clone() const;
     virtual ~MaskCoordinateRectangleFunction();
 
- protected:
+protected:
     virtual bool isInStandardMaskedArea(const int *coordinates) const;
 
- private:
+private:
     int *m_minima;
     int *m_maxima;
 };
@@ -58,15 +58,15 @@ class BA_CORE_API_ MaskCoordinateRectangleFunction : public MaskCoordinateFuncti
 
 class BA_CORE_API_ MaskCoordinateEllipseFunction : public MaskCoordinateFunction
 {
- public:
+public:
     MaskCoordinateEllipseFunction(size_t rank, const int *center, const int *radii);
     virtual MaskCoordinateEllipseFunction *clone() const;
     virtual ~MaskCoordinateEllipseFunction();
 
- protected:
+protected:
     virtual bool isInStandardMaskedArea(const int *coordinates) const;
 
- private:
+private:
     int *m_center;
     int *m_radii;
 };
diff --git a/Core/Algorithms/inc/MultiLayerRoughnessDWBASimulation.h b/Core/Algorithms/inc/MultiLayerRoughnessDWBASimulation.h
index 28d7c22a77bfea2fb597593f0f227a5d04370ecf..289b291a2e927407b6ea1ba75e61e02c64ce9c74 100644
--- a/Core/Algorithms/inc/MultiLayerRoughnessDWBASimulation.h
+++ b/Core/Algorithms/inc/MultiLayerRoughnessDWBASimulation.h
@@ -27,7 +27,7 @@ class MultiLayer;
 
 class MultiLayerRoughnessDWBASimulation : public DWBASimulation
 {
- public:
+public:
     MultiLayerRoughnessDWBASimulation(const MultiLayer *p_multi_layer);
     virtual ~MultiLayerRoughnessDWBASimulation();
 
@@ -48,7 +48,7 @@ class MultiLayerRoughnessDWBASimulation : public DWBASimulation
     virtual double evaluate(const cvector_t& k_i, const cvector_t& k_f,
                             double alpha_i, double alpha_f);
 
- protected:
+protected:
     complex_t get_refractive_term(size_t ilayer) const;
     complex_t get_sum4terms(size_t ilayer,
                             const cvector_t& k_i, const cvector_t& k_f,
diff --git a/Core/Algorithms/inc/ResolutionFunction2DSimple.h b/Core/Algorithms/inc/ResolutionFunction2DSimple.h
index cf947aba7e4587e2e3207171a68768a70a8e2d0a..619e9615d5b461f1c9584573f9fa1afa1b5483d2 100644
--- a/Core/Algorithms/inc/ResolutionFunction2DSimple.h
+++ b/Core/Algorithms/inc/ResolutionFunction2DSimple.h
@@ -22,7 +22,7 @@
 
 class BA_CORE_API_ ResolutionFunction2DSimple : public IResolutionFunction2D
 {
- public:
+public:
     ResolutionFunction2DSimple(double sigma_x, double sigma_y);
     virtual ~ResolutionFunction2DSimple();
 
@@ -30,9 +30,9 @@ class BA_CORE_API_ ResolutionFunction2DSimple : public IResolutionFunction2D
 
     ResolutionFunction2DSimple *clone() const;
 
- protected:
+protected:
     virtual void init_parameters();
- private:
+private:
     //! hiding copy constructor and disabling assignment operator
     ResolutionFunction2DSimple(const ResolutionFunction2DSimple& other);
     ResolutionFunction2DSimple& operator=(const ResolutionFunction2DSimple& );
diff --git a/Core/Algorithms/inc/Simulation.h b/Core/Algorithms/inc/Simulation.h
index 476048da70adc7cab226272fbf1577ecf8f63c26..8bcb39d6de3293fcb83e22ff435924725eeb8390 100644
--- a/Core/Algorithms/inc/Simulation.h
+++ b/Core/Algorithms/inc/Simulation.h
@@ -30,7 +30,7 @@ class ProgramOptions;
 
 class BA_CORE_API_ Simulation : public ICloneable, public IParameterized
 {
- public:
+public:
     Simulation();
     Simulation(const ProgramOptions *p_options);
     Simulation(const ISample& p_sample, const ProgramOptions *p_options=0);
@@ -128,7 +128,7 @@ class BA_CORE_API_ Simulation : public ICloneable, public IParameterized
     //! Apply smearing of intensity due to tilting of z-axis (DEPRECATED)
     void smearIntensityFromZAxisTilting();
 
- protected:
+protected:
     Simulation(const Simulation& other);
 
     //! Registers some class members for later access via parameter pool
diff --git a/Core/Algorithms/inc/SimulationParameters.h b/Core/Algorithms/inc/SimulationParameters.h
index fa97bd56f1db242abfb1be813f57f70035ff60c9..07623b4ff91e882fb4b7bb571942e7b0de831db4 100644
--- a/Core/Algorithms/inc/SimulationParameters.h
+++ b/Core/Algorithms/inc/SimulationParameters.h
@@ -20,7 +20,7 @@
 
 class SimulationParameters
 {
- public:
+public:
     SimulationParameters();
     enum EFramework { DWBA, BA } me_framework;
     enum EInterferenceApproximation { DA, LMA, SSCA, ISGISAXSMOR } me_if_approx;
diff --git a/Core/Algorithms/inc/SizeSpacingCorrelationApproximationStrategy.h b/Core/Algorithms/inc/SizeSpacingCorrelationApproximationStrategy.h
index 42c2a0bc3720dba9a3e103783912b5315b96404b..5f256ec6f8d3e81eddb4b0198214b649ae041306 100644
--- a/Core/Algorithms/inc/SizeSpacingCorrelationApproximationStrategy.h
+++ b/Core/Algorithms/inc/SizeSpacingCorrelationApproximationStrategy.h
@@ -21,30 +21,33 @@
 
 //! ?
 
-class SizeSpacingCorrelationApproximationStrategy : public IInterferenceFunctionStrategy
+class SizeSpacingCorrelationApproximationStrategy
+        : public IInterferenceFunctionStrategy
 {
 public:
-    SizeSpacingCorrelationApproximationStrategy(SimulationParameters sim_params, double kappa);
+    SizeSpacingCorrelationApproximationStrategy(SimulationParameters sim_params,
+            double kappa);
     virtual ~SizeSpacingCorrelationApproximationStrategy() {}
 
     virtual void init(const SafePointerVector<FormFactorInfo>& form_factor_infos,
             const SafePointerVector<IInterferenceFunction>& ifs);
     virtual double evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-            double alpha_i, double alpha_f) const;
+            Bin1D alpha_f_bin) const;
 
     //! Calculates and returns a polarized form factor in DWBA
     virtual Eigen::Matrix2d evaluatePol(const cvector_t& k_i,
-            const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-            double alpha_i, double alpha_f, double phi_f) const;
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
 private:
     bool checkVectorSizes() const;
-    complex_t getMeanCharacteristicFF(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-            double alpha_i, double alpha_f) const;
-    complex_t getMeanConjCharacteristicFF(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-            double alpha_i, double alpha_f) const;
+    complex_t getMeanCharacteristicFF(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
+    complex_t getMeanConjCharacteristicFF(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
     complex_t getCharacteristicDistribution(double qp) const;
     complex_t getCharacteristicSizeCoupling(double qp, double kappa) const;
-    complex_t calculatePositionOffsetPhase(double qp, double kappa, size_t index) const;
+    complex_t calculatePositionOffsetPhase(double qp, double kappa,
+            size_t index) const;
     double getqp(const cvector_t& k_i, const Bin1DCVector& k_f_bin) const;
     void initMeanRadius();
     double m_mean_radius;
diff --git a/Core/Algorithms/src/DecoratedLayerDWBASimulation.cpp b/Core/Algorithms/src/DecoratedLayerDWBASimulation.cpp
index 52c1c2adf6142e22ae45f8cd4a91fe14b956c2df..e3428c4054fd1eff757278962c642efdc3ebd3eb 100644
--- a/Core/Algorithms/src/DecoratedLayerDWBASimulation.cpp
+++ b/Core/Algorithms/src/DecoratedLayerDWBASimulation.cpp
@@ -72,18 +72,14 @@ void DecoratedLayerDWBASimulation::runMagnetic(
         Bin1D alpha_bin = mp_polarization_output->getBinOfAxis(
             "alpha_f", it.getIndex());
         double alpha_f = alpha_bin.getMidPoint();
-        double phi_f = phi_bin.getMidPoint();
         if (m_sim_params.me_framework==SimulationParameters::DWBA &&
                 alpha_f<0) {
             ++it;
             continue;
         }
-        Bin1DCVector k_f_bin1 = getKfBin1_matrix(
-                wavelength, alpha_bin, phi_bin);
-        Bin1DCVector k_f_bin2 = getKfBin2_matrix(
-                wavelength, alpha_bin, phi_bin);
-        *it = p_strategy->evaluatePol(m_ki, k_f_bin1, k_f_bin2, -m_alpha_i,
-                    alpha_f, phi_f) * total_surface_density;
+        Bin1DCVector k_f_bin = getKfBin1_matrix(wavelength, alpha_bin, phi_bin);
+        *it = p_strategy->evaluatePol(m_ki, k_f_bin, alpha_bin, phi_bin)
+                * total_surface_density;
         ++it;
     }
 }
@@ -124,9 +120,8 @@ void DecoratedLayerDWBASimulation::calculateCoherentIntensity(
             continue;
         }
         Bin1DCVector k_f_bin = getKfBin(wavelength, alpha_bin, phi_bin);
-        *it_intensity =
-            p_strategy->evaluate(k_ij, k_f_bin,
-                                 -m_alpha_i, alpha_f)*total_surface_density;
+        *it_intensity = p_strategy->evaluate(k_ij, k_f_bin, alpha_bin)
+                      * total_surface_density;
         ++it_intensity;
     }
 }
diff --git a/Core/Algorithms/src/DecouplingApproximationStrategy.cpp b/Core/Algorithms/src/DecouplingApproximationStrategy.cpp
index 50c2575d89a4f800557511743da92b7372f94b7b..526611b62052cb188cac33e587f497e869268aee 100644
--- a/Core/Algorithms/src/DecouplingApproximationStrategy.cpp
+++ b/Core/Algorithms/src/DecouplingApproximationStrategy.cpp
@@ -32,15 +32,14 @@ void DecouplingApproximationStrategy::init(
     }
 }
 
-double DecouplingApproximationStrategy::evaluate(
-    const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-    double alpha_i, double alpha_f) const
+double DecouplingApproximationStrategy::evaluate(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
     double intensity = 0.0;
     complex_t amplitude = complex_t(0.0, 0.0);
     for (size_t i=0; i<m_ff_infos.size(); ++i) {
         complex_t ff =
-            m_ff_infos[i]->mp_ff->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+            m_ff_infos[i]->mp_ff->evaluate(k_i, k_f_bin, alpha_f_bin);
 
         if (MathFunctions::isnan(ff.real())) {
             std::cout << "Amplitude is NaN: i = " << i << std::endl;
@@ -61,9 +60,8 @@ double DecouplingApproximationStrategy::evaluate(
 }
 
 Eigen::Matrix2d DecouplingApproximationStrategy::evaluatePol(
-        const cvector_t& k_i, const Bin1DCVector& k_f1_bin,
-        const Bin1DCVector& k_f2_bin, double alpha_i, double alpha_f,
-        double phi_f) const
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
+        Bin1D alpha_f_bin, Bin1D phi_f_bin) const
 {
     Eigen::Matrix2d intensity = Eigen::Matrix2d::Zero();
     Eigen::Matrix2cd amplitude = Eigen::Matrix2cd::Zero();
@@ -75,15 +73,15 @@ Eigen::Matrix2d DecouplingApproximationStrategy::evaluatePol(
                     "DecouplingApproximationStrategy::evaluatePol: "
                     "unpolarized form factor encountered");
         }
-        Eigen::Matrix2cd  ff = p_ff_pol->evaluatePol(k_i, k_f1_bin, k_f2_bin,
-                alpha_i, alpha_f, phi_f);
+        Eigen::Matrix2cd  ff = p_ff_pol->evaluatePol(k_i, k_f_bin,
+                alpha_f_bin, phi_f_bin);
 
         double fraction = m_ff_infos[i]->m_abundance;
         amplitude += fraction*ff;
         intensity += fraction*(MathFunctions::Norm(ff));
     }
     Eigen::Matrix2d amplitude_norm = MathFunctions::Norm(amplitude);
-    double itf_function = m_ifs[0]->evaluate(k_i-k_f1_bin.getMidPoint());
+    double itf_function = m_ifs[0]->evaluate(k_i-k_f_bin.getMidPoint());
     return intensity + amplitude_norm*(itf_function-1.0);
 }
 
diff --git a/Core/Algorithms/src/DiffuseDWBASimulation.cpp b/Core/Algorithms/src/DiffuseDWBASimulation.cpp
index da33d91c90dbdd173c3d8d3fefb9e78ef3f32f92..a9b2548d99d9f61847b7277906d093d3d88a53bb 100644
--- a/Core/Algorithms/src/DiffuseDWBASimulation.cpp
+++ b/Core/Algorithms/src/DiffuseDWBASimulation.cpp
@@ -17,8 +17,6 @@
 #include "FormFactorDWBAConstZ.h"
 #include "MessageService.h"
 
-#define SQR(x) ((x)*(x))
-
 //! Carry out one simulation thread.
 
 void DiffuseDWBASimulation::run()
@@ -28,10 +26,10 @@ void DiffuseDWBASimulation::run()
     std::vector<DiffuseFormFactorTerm*> diffuse_terms;
     size_t nbr_heights = 50;
     size_t samples_per_particle = 9;
-    initDiffuseFormFactorTerms(
-        diffuse_terms, nbr_heights, samples_per_particle);
+    double wavevector_scattering_factor = M_PI/getWaveLength()/getWaveLength();
+    initDiffuseFormFactorTerms(diffuse_terms, nbr_heights, samples_per_particle,
+            wavevector_scattering_factor);
 
-    double wavevector_scattering_factor = M_PI/SQR(getWaveLength());
     cvector_t k_ij = m_ki;
 
     k_ij.setZ(-(complex_t)mp_specular_info->getInCoefficients()->getScalarKz());
@@ -55,14 +53,14 @@ void DiffuseDWBASimulation::run()
             for (size_t j=0; j<p_diffuse_term->m_form_factors.size(); ++j) {
                 complex_t amp =
                     p_diffuse_term->m_form_factors[j]->evaluate(
-                        k_ij, k_f_bin, -m_alpha_i, alpha_f);
+                        k_ij, k_f_bin, alpha_bin);
                 amplitude += p_diffuse_term->m_probabilities[j]*amp;
                 intensity += p_diffuse_term->m_probabilities[j]*std::norm(amp);
             }
             total_intensity +=
                 p_diffuse_term->m_factor * (intensity - std::norm(amplitude));
         }
-        *it_intensity = total_intensity * SQR(wavevector_scattering_factor);
+        *it_intensity = total_intensity;
     }
 
     for (size_t i=0; i<diffuse_terms.size(); ++i)
@@ -80,7 +78,7 @@ void DiffuseDWBASimulation::run()
 void DiffuseDWBASimulation::initDiffuseFormFactorTerms(
         std::vector<DiffuseFormFactorTerm*>& terms,
         size_t nbr_heights,
-        size_t samples_per_particle)
+        size_t samples_per_particle, complex_t wavevector_scattering_factor)
 {
     msglog(MSG::DEBUG) << "DiffuseDWBASimulation::init...()";
     for (size_t i=0; i<m_np_infos.size(); ++i) {
@@ -100,7 +98,8 @@ void DiffuseDWBASimulation::initDiffuseFormFactorTerms(
                 samples_per_particle);
             for (size_t ff_index=0; ff_index<form_factors.size(); ++ff_index) {
                 p_particle->setSimpleFormFactor(form_factors[ff_index]);
-                IFormFactor *ff_particle = p_particle->createFormFactor();
+                IFormFactor *ff_particle = p_particle->createFormFactor(
+                        wavevector_scattering_factor);
                 FormFactorDWBAConstZ *p_dwba_z =
                     new FormFactorDWBAConstZ(ff_particle, depth);
                 p_dwba_z->setSpecularInfo(*mp_specular_info);
diff --git a/Core/Algorithms/src/IsGISAXSMorphologyFileStrategy.cpp b/Core/Algorithms/src/IsGISAXSMorphologyFileStrategy.cpp
index 0813c9d85aeb73b039fb00f6ad5e57136b9c4713..6daf7198c1e9e0265cfd290134b4a2427e2410d8 100644
--- a/Core/Algorithms/src/IsGISAXSMorphologyFileStrategy.cpp
+++ b/Core/Algorithms/src/IsGISAXSMorphologyFileStrategy.cpp
@@ -60,7 +60,7 @@ void IsGISAXSMorphologyFileStrategy::initPositions()
 }
 
 double IsGISAXSMorphologyFileStrategy::evaluate(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
     cvector_t q = k_i - k_f_bin.getMidPoint();
     complex_t mean_ff = complex_t(0., 0.);
@@ -68,7 +68,8 @@ double IsGISAXSMorphologyFileStrategy::evaluate(const cvector_t& k_i,
     // calculate form factors
     std::vector<complex_t> ff_values;
     for (size_t i=0; i<m_ff_infos.size(); ++i) {
-        ff_values.push_back(m_ff_infos[i]->mp_ff->evaluate(k_i, k_f_bin, alpha_i, alpha_f));
+        ff_values.push_back(m_ff_infos[i]->mp_ff->evaluate(
+                k_i, k_f_bin, alpha_f_bin));
         mean_ff += m_ff_infos[i]->m_abundance*ff_values[i];
     }
 
@@ -78,7 +79,8 @@ double IsGISAXSMorphologyFileStrategy::evaluate(const cvector_t& k_i,
         complex_t phase = q.x()*m_x_positions[i] + q.y()*m_y_positions[i];
         double fraction = m_ff_infos[i]->m_abundance;
         double hann_value = hannFunction(m_x_positions[i], m_y_positions[i]);
-        coherent_amplitude += fraction*ff_values[i]*std::exp( complex_t(0., 1.0)*phase )*hann_value;
+        coherent_amplitude += fraction*ff_values[i]
+                            * std::exp( complex_t(0., 1.0)*phase )*hann_value;
     }
     double coherent_intensity = std::norm(coherent_amplitude);
 
@@ -90,7 +92,8 @@ double IsGISAXSMorphologyFileStrategy::evaluate(const cvector_t& k_i,
             double x_diff = m_x_positions[i]-m_x_positions[j];
             double y_diff = m_y_positions[i]-m_y_positions[j];
             complex_t phase = q.x()*x_diff + q.y()*y_diff;
-            diffuse_intensity += m_ff_infos[i]->m_abundance * m_ff_infos[j]->m_abundance *
+            diffuse_intensity += m_ff_infos[i]->m_abundance
+                    * m_ff_infos[j]->m_abundance *
                     2.0*(ff_values[i]*std::conj(ff_values[j]) *
                     std::exp( complex_t(0., 1.0)*phase )).real();
         }
@@ -109,16 +112,13 @@ double IsGISAXSMorphologyFileStrategy::evaluate(const cvector_t& k_i,
 }
 
 Eigen::Matrix2d IsGISAXSMorphologyFileStrategy::evaluatePol(
-        const cvector_t& k_i, const Bin1DCVector& k_f1_bin,
-        const Bin1DCVector& k_f2_bin, double alpha_i, double alpha_f,
-        double phi_f) const
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
+        Bin1D alpha_f_bin, Bin1D phi_f_bin) const
 {
     (void)k_i;
-    (void)k_f1_bin;
-    (void)k_f2_bin;
-    (void)alpha_i;
-    (void)alpha_f;
-    (void)phi_f;
+    (void)k_f_bin;
+    (void)alpha_f_bin;
+    (void)phi_f_bin;
     throw Exceptions::NotImplementedException("IsGISAXSMorphologyFileStrategy::"
             "evaluatePol: this strategy is not implemented for magnetic "
             "systems");
diff --git a/Core/Algorithms/src/LayerStrategyBuilder.cpp b/Core/Algorithms/src/LayerStrategyBuilder.cpp
index b0a990a6916f74537e3c10ee604fd9aaa6bcc306..4149c1a12500889d74a6464e8f5b1a074f3ad8b0 100644
--- a/Core/Algorithms/src/LayerStrategyBuilder.cpp
+++ b/Core/Algorithms/src/LayerStrategyBuilder.cpp
@@ -115,14 +115,8 @@ void LayerStrategyBuilder::collectFormFactorInfos()
         const ParticleInfo *p_particle_info =
             p_decoration->getParticleInfo(particle_index);
         FormFactorInfo *p_ff_info;
-        if (requiresMatrixFFs()) {
-            p_ff_info = createFormFactorInfoPol(p_particle_info,
-                    p_layer_material, wavevector_scattering_factor);
-        }
-        else {
-            p_ff_info = createFormFactorInfo(p_particle_info, p_layer_material,
-                    wavevector_scattering_factor);
-        }
+        p_ff_info = createFormFactorInfo(p_particle_info, p_layer_material,
+                wavevector_scattering_factor);
         p_ff_info->m_abundance =
             p_decoration->getAbundanceFractionOfParticle(particle_index);
         m_ff_infos.push_back(p_ff_info);
@@ -155,111 +149,32 @@ FormFactorInfo *LayerStrategyBuilder::createFormFactorInfo(
     FormFactorInfo *p_result = new FormFactorInfo;
     boost::scoped_ptr<Particle> P_particle_clone(p_particle_info->
             getParticle()->clone());
-    const Geometry::PTransform3D transform = p_particle_info->getPTransform3D();
-
-    // formfactor
     P_particle_clone->setAmbientMaterial(p_ambient_material);
-    IFormFactor *ff_particle = P_particle_clone->createFormFactor();
-    IFormFactor *ff_transformed(ff_particle);
-    if(transform) {
-        ff_transformed = new FormFactorDecoratorTransformation(ff_particle, transform);
-    }
-    IFormFactor *p_ff_framework(ff_transformed);
-    switch (m_sim_params.me_framework)
-    {
-    case SimulationParameters::BA:    // Born Approximation
-        break;
-    case SimulationParameters::DWBA:  // Distorted Wave Born Approximation
-    {
-        assert(mp_specular_info);
-        double depth = p_particle_info->getDepth();
-        FormFactorDWBAConstZ *p_dwba_ff =
-            new FormFactorDWBAConstZ(ff_transformed, depth);
-        p_dwba_ff->setSpecularInfo(*mp_specular_info);
-        p_ff_framework = p_dwba_ff;
-        break;
-    }
-    default:
-        throw Exceptions::RuntimeErrorException("Framework must be BA or DWBA");
-    }
-    IFormFactor *p_ff(p_ff_framework);
-    if ( factor != complex_t(1.0, 0.0) ) {
-        p_ff = new FormFactorDecoratorFactor(p_ff_framework, factor);
-    }
-    p_result->mp_ff = p_ff;
-    // Other info (position and abundance
-    const PositionParticleInfo *p_pos_particle_info =
-        dynamic_cast<const PositionParticleInfo *>(p_particle_info);
-    if (p_pos_particle_info) {
-        kvector_t position = p_pos_particle_info->getPosition();
-        p_result->m_pos_x = position.x();
-        p_result->m_pos_y = position.y();
-    }
-    p_result->m_abundance = p_particle_info->getAbundance();
-    return p_result;
-}
-
-FormFactorInfo* LayerStrategyBuilder::createFormFactorInfoPol(
-        const ParticleInfo* p_particle_info,
-        const IMaterial* p_ambient_material, complex_t factor) const
-{
-    FormFactorInfo *p_result = new FormFactorInfo;
-    boost::scoped_ptr<Particle> P_particle_clone(p_particle_info->
-            getParticle()->clone());
-    const Geometry::PTransform3D transform = p_particle_info->getPTransform3D();
-    const IMaterial *p_material = P_particle_clone->getMaterial();
 
     // formfactor
-    IFormFactor *ff_particle = P_particle_clone->getSimpleFormFactor()->clone();
-    IFormFactor *ff_particle_factor(ff_particle);
-    if ( factor!=complex_t(1.0,0.0) ) {
-        ff_particle_factor = new FormFactorDecoratorFactor(ff_particle, factor);
-    }
-    IFormFactor *ff_transformed(ff_particle_factor);
-    if(transform) {
-        ff_transformed = new FormFactorDecoratorTransformation(
-                ff_particle_factor, transform);
-    }
-    IFormFactor *p_ff_framework(ff_transformed);
+    IFormFactor *p_ff_particle = P_particle_clone->createFormFactor(factor);
+    IFormFactor *p_ff_framework(p_ff_particle);
     switch (m_sim_params.me_framework)
     {
     case SimulationParameters::BA:    // Born Approximation
-    {
-        FormFactorPol *p_ff_pol = new FormFactorPol(ff_transformed);
-        if (mp_specular_info) {
-            p_ff_pol->setSpecularInfo(*mp_specular_info);
-        }
-        p_ff_pol->setMaterial(p_material);
-        p_ff_pol->setAmbientMaterial(p_ambient_material);
-        p_ff_framework = p_ff_pol;
         break;
-    }
     case SimulationParameters::DWBA:  // Distorted Wave Born Approximation
     {
-        if (!mp_specular_info) {
-            throw Exceptions::ClassInitializationException(
-                    "Magnetic coefficients are necessary for DWBA");
-        }
+        assert(mp_specular_info);
         double depth = p_particle_info->getDepth();
-        FormFactorDWBAPol *p_dwba_ff_pol(0);
-        if (depth) {
-            p_dwba_ff_pol = new FormFactorDWBAPolConstZ(ff_transformed, depth);
-
+        if (requiresMatrixFFs()) {
+            p_ff_framework = createDWBAMatrixFormFactor(p_ff_particle, depth);
         }
         else {
-            p_dwba_ff_pol = new FormFactorDWBAPol(ff_transformed);
+            p_ff_framework = createDWBAScalarFormFactor(p_ff_particle, depth);
         }
-        p_dwba_ff_pol->setSpecularInfo(*mp_specular_info);
-        p_dwba_ff_pol->setMaterial(p_material);
-        p_dwba_ff_pol->setAmbientMaterial(p_ambient_material);
-        p_ff_framework = p_dwba_ff_pol;
         break;
     }
     default:
         throw Exceptions::RuntimeErrorException("Framework must be BA or DWBA");
     }
     p_result->mp_ff = p_ff_framework;
-    // Other info (position and abundance)
+    // Other info (position and abundance
     const PositionParticleInfo *p_pos_particle_info =
         dynamic_cast<const PositionParticleInfo *>(p_particle_info);
     if (p_pos_particle_info) {
@@ -287,3 +202,25 @@ FormFactorInfo* FormFactorInfo::clone() const
     return p_result;
 }
 
+IFormFactor* LayerStrategyBuilder::createDWBAScalarFormFactor(
+        IFormFactor* p_form_factor, double depth) const
+{
+    FormFactorDWBAConstZ *p_result =
+        new FormFactorDWBAConstZ(p_form_factor, depth);
+    p_result->setSpecularInfo(*mp_specular_info);
+    return p_result;
+}
+
+IFormFactor* LayerStrategyBuilder::createDWBAMatrixFormFactor(
+        IFormFactor* p_form_factor, double depth) const
+{
+    FormFactorDWBAPol *p_result(0);
+    if (depth) {
+        p_result = new FormFactorDWBAPolConstZ(p_form_factor, depth);
+    }
+    else {
+        p_result = new FormFactorDWBAPol(p_form_factor);
+    }
+    p_result->setSpecularInfo(*mp_specular_info);
+    return p_result;
+}
diff --git a/Core/Algorithms/src/LocalMonodisperseApproximationStrategy.cpp b/Core/Algorithms/src/LocalMonodisperseApproximationStrategy.cpp
index c4b46c379a4a4cb609fc92c2dfd716ed2035f409..054c913165abeced9bdcaea508b33bf46734f157 100644
--- a/Core/Algorithms/src/LocalMonodisperseApproximationStrategy.cpp
+++ b/Core/Algorithms/src/LocalMonodisperseApproximationStrategy.cpp
@@ -35,25 +35,30 @@ void LocalMonodisperseApproximationStrategy::init(
 }
 
 double LocalMonodisperseApproximationStrategy::evaluate(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
     double intensity = 0.0;
     cvector_t q = getQ(k_i, k_f_bin);
     if (m_sim_params.me_lattice_type==SimulationParameters::LATTICE) {
         complex_t amplitude(0.0, 0.0);
-        //double mean_squared_ff = meanSquaredFormFactor(k_i, k_f_bin, alpha_i, alpha_f);
-        for (SafePointerVector<FormFactorInfo>::const_iterator it=m_ff_infos.begin();
-                it != m_ff_infos.end(); ++it) {
+        // double mean_squared_ff =
+        // meanSquaredFormFactor(k_i, k_f_bin, alpha_i, alpha_f);
+        for (SafePointerVector<FormFactorInfo>::const_iterator it =
+                m_ff_infos.begin(); it != m_ff_infos.end(); ++it) {
             double fraction = (*it)->m_abundance;
-            complex_t ff = (*it)->mp_ff->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+            complex_t ff = (*it)->mp_ff->evaluate(
+                    k_i, k_f_bin, alpha_f_bin);
             complex_t phase = q.x()*(*it)->m_pos_x + q.y()*(*it)->m_pos_y;
-            amplitude += fraction*std::abs(ff)*std::exp(complex_t(0.0, 1.0)*phase);
+            amplitude += fraction*std::abs(ff)
+                       * std::exp(complex_t(0.0, 1.0)*phase);
         }
-        intensity = std::norm(amplitude)*m_ifs[0]->evaluate(k_i-k_f_bin.getMidPoint());
+        intensity = std::norm(amplitude)*m_ifs[0]->evaluate(
+                k_i-k_f_bin.getMidPoint());
     }
     else {
         for (size_t i=0; i<m_ff_infos.size(); ++i) {
-            complex_t ff = m_ff_infos[i]->mp_ff->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+            complex_t ff = m_ff_infos[i]->mp_ff->evaluate(
+                    k_i, k_f_bin, alpha_f_bin);
             double itf_function = m_ifs[i]->evaluate(k_i-k_f_bin.getMidPoint());
             double fraction = m_ff_infos[i]->m_abundance;
             intensity += fraction*(itf_function*std::norm(ff));
@@ -66,16 +71,13 @@ double LocalMonodisperseApproximationStrategy::evaluate(const cvector_t& k_i,
 }
 
 Eigen::Matrix2d LocalMonodisperseApproximationStrategy::evaluatePol(
-        const cvector_t& k_i, const Bin1DCVector& k_f1_bin,
-        const Bin1DCVector& k_f2_bin, double alpha_i, double alpha_f,
-        double phi_f) const
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
+        Bin1D alpha_f_bin, Bin1D phi_f_bin) const
 {
     (void)k_i;
-    (void)k_f1_bin;
-    (void)k_f2_bin;
-    (void)alpha_i;
-    (void)alpha_f;
-    (void)phi_f;
+    (void)k_f_bin;
+    (void)alpha_f_bin;
+    (void)phi_f_bin;
     throw Exceptions::NotImplementedException(
             "LocalMonodisperseApproximationStrategy::evaluatePol: "
             "this strategy is not implemented for magnetic systems");
diff --git a/Core/Algorithms/src/SizeSpacingCorrelationApproximationStrategy.cpp b/Core/Algorithms/src/SizeSpacingCorrelationApproximationStrategy.cpp
index 6cf244c3b892955d68696270d05272185bc0443e..b46fd6283dec7ae76a23baa92e78020bcc8f96ed 100644
--- a/Core/Algorithms/src/SizeSpacingCorrelationApproximationStrategy.cpp
+++ b/Core/Algorithms/src/SizeSpacingCorrelationApproximationStrategy.cpp
@@ -37,34 +37,32 @@ void SizeSpacingCorrelationApproximationStrategy::init(
 }
 
 double SizeSpacingCorrelationApproximationStrategy::evaluate(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
     double qp = getqp(k_i, k_f_bin);
     double diffuse_intensity = 0.0;
     for (size_t i=0; i<m_ff_infos.size(); ++i) {
-        complex_t ff = m_ff_infos[i]->mp_ff->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+        complex_t ff = m_ff_infos[i]->mp_ff->evaluate(k_i, k_f_bin, alpha_f_bin);
         double fraction = m_ff_infos[i]->m_abundance;
         diffuse_intensity += fraction*(std::norm(ff));
     }
-    complex_t mcff = getMeanCharacteristicFF(k_i, k_f_bin, alpha_i, alpha_f);
-    complex_t mcffc = getMeanConjCharacteristicFF(k_i, k_f_bin, alpha_i, alpha_f);
+    complex_t mcff = getMeanCharacteristicFF(k_i, k_f_bin, alpha_f_bin);
+    complex_t mcffc = getMeanConjCharacteristicFF(k_i, k_f_bin, alpha_f_bin);
     complex_t p2kappa = getCharacteristicSizeCoupling(qp, 2.0*m_kappa);
     complex_t omega = getCharacteristicDistribution(qp);
-    double interference_intensity = 2.0*( mcff*mcffc*omega/(1.0 - p2kappa*omega) ).real();
+    double interference_intensity = 2.0
+            * ( mcff*mcffc*omega/(1.0 - p2kappa*omega) ).real();
     return diffuse_intensity + interference_intensity;
 }
 
 Eigen::Matrix2d SizeSpacingCorrelationApproximationStrategy::evaluatePol(
-        const cvector_t& k_i, const Bin1DCVector& k_f1_bin,
-        const Bin1DCVector& k_f2_bin, double alpha_i, double alpha_f,
-        double phi_f) const
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
+        Bin1D alpha_f_bin, Bin1D phi_f_bin) const
 {
     (void)k_i;
-    (void)k_f1_bin;
-    (void)k_f2_bin;
-    (void)alpha_i;
-    (void)alpha_f;
-    (void)phi_f;
+    (void)k_f_bin;
+    (void)alpha_f_bin;
+    (void)phi_f_bin;
     throw Exceptions::NotImplementedException(
             "SizeSpacingCorrelationApproximationStrategy::evaluatePol: "
             "this strategy is not implemented for magnetic systems");
@@ -78,57 +76,63 @@ bool SizeSpacingCorrelationApproximationStrategy::checkVectorSizes() const
 }
 
 complex_t SizeSpacingCorrelationApproximationStrategy::getMeanCharacteristicFF(
-        const cvector_t& k_i, const Bin1DCVector& k_f_bin, double alpha_i,
-        double alpha_f) const
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
     double qp = getqp(k_i, k_f_bin);
     complex_t result(0.0, 0.0);
     for (size_t i=0; i<m_ff_infos.size(); ++i) {
-        result += m_ff_infos[i]->m_abundance*m_ff_infos[i]->mp_ff->evaluate(k_i, k_f_bin, alpha_i, alpha_f)*
+        result += m_ff_infos[i]->m_abundance*m_ff_infos[i]->mp_ff->
+                evaluate(k_i, k_f_bin, alpha_f_bin) *
                 calculatePositionOffsetPhase(qp, m_kappa, i);
     }
     return result;
 }
 
-complex_t SizeSpacingCorrelationApproximationStrategy::getMeanConjCharacteristicFF(
-        const cvector_t& k_i, const Bin1DCVector& k_f_bin, double alpha_i,
-        double alpha_f) const
+complex_t
+SizeSpacingCorrelationApproximationStrategy::getMeanConjCharacteristicFF(
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
     double qp = getqp(k_i, k_f_bin);
     complex_t result(0.0, 0.0);
     for (size_t i=0; i<m_ff_infos.size(); ++i) {
-        result += m_ff_infos[i]->m_abundance*std::conj(m_ff_infos[i]->mp_ff->evaluate(k_i, k_f_bin, alpha_i, alpha_f))*
+        result += m_ff_infos[i]->m_abundance*std::conj(m_ff_infos[i]->mp_ff->
+                evaluate(k_i, k_f_bin, alpha_f_bin)) *
                 calculatePositionOffsetPhase(qp, m_kappa, i);
     }
     return result;
 }
 
-complex_t SizeSpacingCorrelationApproximationStrategy::getCharacteristicDistribution(
+complex_t
+SizeSpacingCorrelationApproximationStrategy::getCharacteristicDistribution(
         double qp) const
 {
-    const InterferenceFunction1DParaCrystal *p_iff = dynamic_cast<const InterferenceFunction1DParaCrystal *>(
-            m_ifs[0]);
+    const InterferenceFunction1DParaCrystal *p_iff =
+            dynamic_cast<const InterferenceFunction1DParaCrystal *>(m_ifs[0]);
     if (p_iff==0) {
         throw ClassInitializationException("Wrong interference function for SSCA");
     }
     return p_iff->FTGaussianCorrLength(qp);
 }
 
-complex_t SizeSpacingCorrelationApproximationStrategy::getCharacteristicSizeCoupling(
+complex_t
+SizeSpacingCorrelationApproximationStrategy::getCharacteristicSizeCoupling(
         double qp, double kappa) const
 {
     size_t n_frs = m_ff_infos.size();
     complex_t result = complex_t(0.0, 0.0);
     for (size_t i=0; i<n_frs; ++i) {
-        result += m_ff_infos[i]->m_abundance* calculatePositionOffsetPhase(qp, kappa, i);
+        result += m_ff_infos[i]->m_abundance
+                * calculatePositionOffsetPhase(qp, kappa, i);
     }
     return result;
 }
 
-complex_t SizeSpacingCorrelationApproximationStrategy::calculatePositionOffsetPhase(
+complex_t
+SizeSpacingCorrelationApproximationStrategy::calculatePositionOffsetPhase(
         double qp, double kappa, size_t index) const
 {
-    return std::exp(complex_t(0.0, 1.0)*kappa*qp*(m_ff_infos[index]->mp_ff->getRadius()-m_mean_radius));
+    return std::exp(complex_t(0.0, 1.0) * kappa * qp
+            * (m_ff_infos[index]->mp_ff->getRadius()-m_mean_radius));
 }
 
 double SizeSpacingCorrelationApproximationStrategy::getqp(const cvector_t& k_i,
@@ -144,7 +148,8 @@ void SizeSpacingCorrelationApproximationStrategy::initMeanRadius()
 {
     m_mean_radius = 0.0;
     for (size_t i=0; i<m_ff_infos.size(); ++i) {
-        m_mean_radius += m_ff_infos[i]->m_abundance*m_ff_infos[i]->mp_ff->getRadius();
+        m_mean_radius += m_ff_infos[i]->m_abundance
+                       * m_ff_infos[i]->mp_ff->getRadius();
     }
 }
 
diff --git a/Core/Core.pro b/Core/Core.pro
index d4a2fca09fef6e716be2879f6b9fe03e0e102401..0587d6d47518ef6cd71330cfc5d181e9946e583c 100644
--- a/Core/Core.pro
+++ b/Core/Core.pro
@@ -90,6 +90,9 @@ SOURCES += \
     FormFactors/src/FormFactorDWBAConstZ.cpp \
     FormFactors/src/FormFactorDWBAPol.cpp \
     FormFactors/src/FormFactorDWBAPolConstZ.cpp \
+    FormFactors/src/FormFactorDecoratorDebyeWaller.cpp \
+    FormFactors/src/FormFactorDecoratorMaterial.cpp \
+    FormFactors/src/FormFactorDecoratorMultiPositionFactor.cpp \
     FormFactors/src/FormFactorDecoratorTransformation.cpp \
     FormFactors/src/FormFactorEllipsoid.cpp \
     FormFactors/src/FormFactorFullSphere.cpp \
@@ -98,7 +101,6 @@ SOURCES += \
     FormFactors/src/FormFactorHemiSpheroid.cpp \
     FormFactors/src/FormFactorLorentz.cpp \
     FormFactors/src/FormFactorParallelepiped.cpp \
-    FormFactors/src/FormFactorPol.cpp \
     FormFactors/src/FormFactorPrism3.cpp \
     FormFactors/src/FormFactorPrism6.cpp \
     FormFactors/src/FormFactorPyramid.cpp \
@@ -247,9 +249,9 @@ HEADERS += \
     FormFactors/inc/FormFactorDWBAPolConstZ.h \
     FormFactors/inc/FormFactorDecoratorDebyeWaller.h \
     FormFactors/inc/FormFactorDecoratorFactor.h \
+    FormFactors/inc/FormFactorDecoratorMaterial.h \
     FormFactors/inc/FormFactorDecoratorMultiPositionFactor.h \
     FormFactors/inc/FormFactorDecoratorPositionFactor.h \
-    FormFactors/inc/FormFactorDecoratorRefractiveIndex.h \
     FormFactors/inc/FormFactorDecoratorTransformation.h \
     FormFactors/inc/FormFactorEllipsoid.h \
     FormFactors/inc/FormFactorFullSphere.h \
@@ -258,7 +260,6 @@ HEADERS += \
     FormFactors/inc/FormFactorHemiSpheroid.h \
     FormFactors/inc/FormFactorLorentz.h \
     FormFactors/inc/FormFactorParallelepiped.h \
-    FormFactors/inc/FormFactorPol.h \
     FormFactors/inc/FormFactorPrism3.h \
     FormFactors/inc/FormFactorPrism6.h \
     FormFactors/inc/FormFactorPyramid.h \
@@ -319,7 +320,6 @@ HEADERS += \
     StandardSamples/IsGISAXS09Builder.h \
     Algorithms/inc/LayerStrategyBuilder.h \
     Algorithms/inc/DecoratedLayerDWBASimulation.h \
-    Samples/inc/Version.h
 
 contains(CONFIG, BORNAGAIN_PYTHON) {
    include($$PWD/python_module.pri)
diff --git a/Core/FormFactors/inc/FormFactorBox.h b/Core/FormFactors/inc/FormFactorBox.h
index dadda4f248049668d9ca6c6ec9da3d7dd27fd7d8..a1f5c114f131d4a852680f4bb7e8afcb0c0cbdd9 100644
--- a/Core/FormFactors/inc/FormFactorBox.h
+++ b/Core/FormFactors/inc/FormFactorBox.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorBox : public IFormFactorBorn
 {
- public:
+public:
     FormFactorBox( double radius, double width, double height)
         : m_radius(radius), m_width(width), m_height(height) {}
 
@@ -47,10 +47,10 @@ class BA_CORE_API_ FormFactorBox : public IFormFactorBorn
 
     double getHeight() const { return m_height; }
 
- protected:
+protected:
     void init_parameters();
 
- private:
+private:
     double m_radius;
     double m_width;
     double m_height;
diff --git a/Core/FormFactors/inc/FormFactorCone.h b/Core/FormFactors/inc/FormFactorCone.h
index b6d60feedd74298fe0df1eeddabd12e61161a6e6..389caace583652b33466a696ac8b80ef1ccb6fd3 100644
--- a/Core/FormFactors/inc/FormFactorCone.h
+++ b/Core/FormFactors/inc/FormFactorCone.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorCone : public IFormFactorBorn
 {
- public:
+public:
     //! @brief Cone constructor
     //! @param height of Conee
     //! @param radius half of Cone's base
@@ -38,11 +38,11 @@ class BA_CORE_API_ FormFactorCone : public IFormFactorBorn
 
     virtual double getHeight() const { return m_height; }
 
- protected:
+protected:
     virtual complex_t evaluate_for_q (const cvector_t& q) const;
     virtual void init_parameters();
 
- private:
+private:
     //    double ConeIntegral(double Z, void* params) const;
     double evaluate_for_q_real() const;
     double evaluate_for_q_imag() const;
diff --git a/Core/FormFactors/inc/FormFactorCrystal.h b/Core/FormFactors/inc/FormFactorCrystal.h
index 08f2b4efbb5647b18359a6c3b4187ec483e2ab6b..ac3ce0dc5f5921aa5bd7c3b13d2af2195f562de0 100644
--- a/Core/FormFactors/inc/FormFactorCrystal.h
+++ b/Core/FormFactors/inc/FormFactorCrystal.h
@@ -23,10 +23,10 @@
 
 class BA_CORE_API_ FormFactorCrystal : public IFormFactorBorn
 {
- public:
+public:
     FormFactorCrystal(
         const Crystal& p_crystal, const IFormFactor& meso_crystal_form_factor,
-        const IMaterial *p_material);
+        const IMaterial *p_material, complex_t wavevector_scattering_factor);
     virtual ~FormFactorCrystal();
 
     virtual FormFactorCrystal *clone() const;
@@ -35,18 +35,24 @@ class BA_CORE_API_ FormFactorCrystal : public IFormFactorBorn
 
     virtual void setAmbientMaterial(const IMaterial *p_material);
 
-    virtual complex_t evaluate(
-        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-        double alpha_i, double alpha_f) const;
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
+
+#ifndef GCCXML_SKIP_THIS
+    virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
+#endif
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
     virtual double getVolume() const;
 
- private:
+private:
     void calculateLargestReciprocalDistance();
 
     Lattice m_lattice;
+    complex_t m_wavevector_scattering_factor;
     Particle *mp_particle;
     IFormFactor *mp_basis_form_factor;
     IFormFactor *mp_meso_form_factor;
diff --git a/Core/FormFactors/inc/FormFactorCylinder.h b/Core/FormFactors/inc/FormFactorCylinder.h
index 524ca416178b2638b3f7dd25ca9394435f8865ec..742bc6b44f339bbf7de3f88cbc69eece2d8b0314 100644
--- a/Core/FormFactors/inc/FormFactorCylinder.h
+++ b/Core/FormFactors/inc/FormFactorCylinder.h
@@ -22,7 +22,7 @@
 
 class BA_CORE_API_ FormFactorCylinder : public IFormFactorBorn
 {
- public:
+public:
     FormFactorCylinder(double height, double radius);
     ~FormFactorCylinder() {}
     virtual FormFactorCylinder *clone() const;
@@ -39,10 +39,10 @@ class BA_CORE_API_ FormFactorCylinder : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     virtual void init_parameters();
 
- private:
+private:
     double m_height;
     double m_radius;
 };
diff --git a/Core/FormFactors/inc/FormFactorDWBA.h b/Core/FormFactors/inc/FormFactorDWBA.h
index 050c26961a2723b2a0a5f6e4c072934557197dd6..c3050913a888c65884f829985f973d9a9586fef5 100644
--- a/Core/FormFactors/inc/FormFactorDWBA.h
+++ b/Core/FormFactors/inc/FormFactorDWBA.h
@@ -32,15 +32,15 @@ public:
     //! Sets reflection/transmission info for scalar DWBA simulation
     void setSpecularInfo(const LayerSpecularInfo& layer_specular_info);
 
-    virtual complex_t evaluate(const cvector_t& k_i, const Bin1DCVector&
-            k_f_bin, double alpha_i, double alpha_f) const;
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
 
     friend class TestPolarizedDWBATerms;
 
 protected:
     const ILayerRTCoefficients *getOutCoeffs(double alpha_f) const;
     void calculateTerms(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-            double alpha_i, double alpha_f) const;
+            Bin1D alpha_f_bin) const;
 
     LayerSpecularInfo *mp_specular_info;
 
diff --git a/Core/FormFactors/inc/FormFactorDWBAConstZ.h b/Core/FormFactors/inc/FormFactorDWBAConstZ.h
index 1a073b61ad0af5fffbd3eb38cde5c4bec26dbe35..af66cc807636ae0a449463840635a64f919a50c1 100644
--- a/Core/FormFactors/inc/FormFactorDWBAConstZ.h
+++ b/Core/FormFactors/inc/FormFactorDWBAConstZ.h
@@ -28,8 +28,7 @@ public:
     virtual FormFactorDWBAConstZ *clone() const;
 
     virtual complex_t evaluate(const cvector_t& k_i,
-                               const Bin1DCVector& k_f_bin,
-                               double alpha_i, double alpha_f) const;
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
 protected:
     double m_depth;
 
diff --git a/Core/FormFactors/inc/FormFactorDWBAPol.h b/Core/FormFactors/inc/FormFactorDWBAPol.h
index 0d8e043a78f2b9f917dad0fdb5b17875f4a5a9f0..9a364d94ec90a671116e4a9bbaf97afa1fac15f3 100644
--- a/Core/FormFactors/inc/FormFactorDWBAPol.h
+++ b/Core/FormFactors/inc/FormFactorDWBAPol.h
@@ -16,29 +16,43 @@
 #ifndef FORMFACTORDWBAPOL_H_
 #define FORMFACTORDWBAPOL_H_
 
-#include "FormFactorPol.h"
+#include "IFormFactor.h"
+#include "LayerSpecularInfo.h"
 
 //! Evaluates a coherent sum of the 16 matrix DWBA terms in a polarized form factor
 
-class FormFactorDWBAPol : public FormFactorPol
+class FormFactorDWBAPol : public IFormFactor
 {
 public:
-    FormFactorDWBAPol(IFormFactor *p_formfactor);
+    FormFactorDWBAPol(IFormFactor *p_form_factor);
     virtual ~FormFactorDWBAPol();
 
     virtual FormFactorDWBAPol *clone() const;
 
+    //! Throws exception
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f) const;
+
     //! Calculates and returns a polarized form factor calculation in DWBA
     virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
-            const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-            double alpha_i, double alpha_f, double phi_f) const;
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f, Bin1D phi_f) const;
+
+    //! Sets reflection/transmission info for polarized DWBA
+    void setSpecularInfo(const LayerSpecularInfo& layer_specular_info);
 
     friend class TestPolarizedDWBATerms;
 
 protected:
-    void calculateTerms(const cvector_t& k_i, const Bin1DCVector& k_f1_bin,
-            const Bin1DCVector& k_f2_bin, double alpha_i, double alpha_f,
+    const ILayerRTCoefficients *getOutCoeffs(double alpha_f,
             double phi_f) const;
+    void calculateTerms(const cvector_t& k_i, const Bin1DCVector& k_f_bin,
+            Bin1D alpha_f, Bin1D phi_f) const;
+
+    //! The matrix form factor for BA
+    IFormFactor *mp_form_factor;
+
+    //! The reflection/transmission coefficients in the layer
+    LayerSpecularInfo *mp_specular_info;
 
     //! The following matrices each contain the four polarization conditions
     //! (p->p, p->m, m->p, m->m)
@@ -64,4 +78,10 @@ protected:
     mutable Eigen::Matrix2cd m_M22_RSR;
 };
 
+inline const ILayerRTCoefficients *FormFactorDWBAPol::getOutCoeffs(
+        double alpha_f, double phi_f) const
+{
+    return mp_specular_info->getOutCoefficients(alpha_f, phi_f);
+}
+
 #endif /* FORMFACTORDWBAPOL_H_ */
diff --git a/Core/FormFactors/inc/FormFactorDWBAPolConstZ.h b/Core/FormFactors/inc/FormFactorDWBAPolConstZ.h
index edd114dc4b4b816c3c215995f3d68a9d078f5225..ab4e1b2cff799cc951b25b83b6be7fd3b2a6e7f8 100644
--- a/Core/FormFactors/inc/FormFactorDWBAPolConstZ.h
+++ b/Core/FormFactors/inc/FormFactorDWBAPolConstZ.h
@@ -30,8 +30,7 @@ public:
 
     //! Calculates and returns a polarized form factor calculation in DWBA
     virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
-            const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-            double alpha_i, double alpha_f, double phi_f) const;
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f, Bin1D phi_f) const;
 
 protected:
     double m_depth;
diff --git a/Core/FormFactors/inc/FormFactorDecoratorDebyeWaller.h b/Core/FormFactors/inc/FormFactorDecoratorDebyeWaller.h
index 951542fe428906fd53709868abee4e69f421527a..b290fc758858fc24147b9ca734a1d900403500c4 100644
--- a/Core/FormFactors/inc/FormFactorDecoratorDebyeWaller.h
+++ b/Core/FormFactors/inc/FormFactorDecoratorDebyeWaller.h
@@ -22,75 +22,35 @@
 
 class FormFactorDecoratorDebyeWaller : public IFormFactorDecorator
 {
- public:
+public:
     //! Isotropic Debye-Waller factor.
-    FormFactorDecoratorDebyeWaller(
-        IFormFactor *p_form_factor, double dw_factor)
-    : IFormFactorDecorator(p_form_factor)
-    , m_h_dw_factor(dw_factor)
-    , m_r_dw_factor(dw_factor)
-    {
-        setName("FormFactorDecoratorDebyeWaller");
-        init_parameters();
-    }
+    FormFactorDecoratorDebyeWaller(IFormFactor *p_form_factor,
+            double dw_factor);
 
     //! Anisotropic Debye-Waller factor.
-    FormFactorDecoratorDebyeWaller(
-        IFormFactor *p_form_factor, double dw_h_factor, double dw_r_factor)
-    : IFormFactorDecorator(p_form_factor)
-    , m_h_dw_factor(dw_h_factor)
-    , m_r_dw_factor(dw_r_factor)
-    {
-        setName("FormFactorDecoratorDebyeWaller");
-        init_parameters();
-    }
+    FormFactorDecoratorDebyeWaller(IFormFactor *p_form_factor,
+            double dw_h_factor, double dw_r_factor);
 
     //! Why the hell do we need this alternative form?
-    FormFactorDecoratorDebyeWaller(
-        const IFormFactor& p_form_factor,
-        double dw_h_factor, double dw_r_factor)
-    : IFormFactorDecorator(p_form_factor.clone())
-    , m_h_dw_factor(dw_h_factor)
-    , m_r_dw_factor(dw_r_factor)
-    {
-        setName("FormFactorDecoratorDebyeWaller");
-        init_parameters();
-    }
+    FormFactorDecoratorDebyeWaller(const IFormFactor& p_form_factor,
+        double dw_h_factor, double dw_r_factor);
 
     virtual ~FormFactorDecoratorDebyeWaller() {}
 
-    virtual FormFactorDecoratorDebyeWaller *clone() const
-    {
+    virtual FormFactorDecoratorDebyeWaller *clone() const;
 
-        FormFactorDecoratorDebyeWaller *result = new FormFactorDecoratorDebyeWaller(
-            mp_form_factor->clone(), m_h_dw_factor, m_r_dw_factor);
-        result->setName(getName());
-        return result;
-    }
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
 
-    virtual complex_t evaluate(
-        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-        double alpha_i, double alpha_f) const
-    {
-        cvector_t q = k_i - k_f_bin.getMidPoint();
-        double qr2 = std::norm(q.x()) + std::norm(q.y());
-        double qz2 = std::norm(q.z());
-        double dw = std::exp(-qz2*m_h_dw_factor-qr2*m_r_dw_factor);
-        return dw*mp_form_factor->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+    virtual int getNumberOfStochasticParameters() const {
+        return mp_form_factor->getNumberOfStochasticParameters();
     }
 
-    virtual int getNumberOfStochasticParameters() const
-    { return mp_form_factor->getNumberOfStochasticParameters(); }
-
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
-    virtual void init_parameters() {
-        clearParameterPool();
-        registerParameter("hfactor", &m_h_dw_factor);
-        registerParameter("rfactor", &m_r_dw_factor);
-    }
+    virtual void init_parameters();
 
- private:
+private:
     double m_h_dw_factor; //!< the Debye-Waller factor in the z-direction
     double m_r_dw_factor; //!< the Debye-Waller factor in the radial direction
 };
diff --git a/Core/FormFactors/inc/FormFactorDecoratorFactor.h b/Core/FormFactors/inc/FormFactorDecoratorFactor.h
index 64d70b1a81ab6292b4c650210511aa0c446e4d5b..24c3e1d72f0882e6571f938c09eca0f91a201eca 100644
--- a/Core/FormFactors/inc/FormFactorDecoratorFactor.h
+++ b/Core/FormFactors/inc/FormFactorDecoratorFactor.h
@@ -18,20 +18,22 @@
 
 #include "IFormFactorDecorator.h"
 
-//! ?
+//! Decorates a form factor with a constant factor
 
 class FormFactorDecoratorFactor : public IFormFactorDecorator
 {
- public:
+public:
     FormFactorDecoratorFactor(IFormFactor *p_form_factor, const complex_t& factor);
     virtual FormFactorDecoratorFactor *clone() const;
     virtual ~FormFactorDecoratorFactor() {}
 
-    virtual complex_t evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const;
+    //! Evaluate the form factor for scalar calculations
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
 
     virtual int getNumberOfStochasticParameters() const;
 
- protected:
+protected:
     complex_t m_factor;
 };
 
@@ -45,14 +47,16 @@ inline FormFactorDecoratorFactor::FormFactorDecoratorFactor(
 
 inline FormFactorDecoratorFactor* FormFactorDecoratorFactor::clone() const
 {
-    FormFactorDecoratorFactor *result = new FormFactorDecoratorFactor(mp_form_factor->clone(), m_factor);
+    FormFactorDecoratorFactor *result = new FormFactorDecoratorFactor(
+            mp_form_factor->clone(), m_factor);
     result->setName(getName());
     return result;
 }
 
-inline complex_t FormFactorDecoratorFactor::evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
+inline complex_t FormFactorDecoratorFactor::evaluate(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
-    return m_factor*mp_form_factor->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+    return m_factor*mp_form_factor->evaluate(k_i, k_f_bin, alpha_f_bin);
 }
 
 inline int FormFactorDecoratorFactor::getNumberOfStochasticParameters() const
diff --git a/Core/FormFactors/inc/FormFactorDecoratorMaterial.h b/Core/FormFactors/inc/FormFactorDecoratorMaterial.h
new file mode 100644
index 0000000000000000000000000000000000000000..a96fe1f117112a01448a090d4384c8c5ebf87052
--- /dev/null
+++ b/Core/FormFactors/inc/FormFactorDecoratorMaterial.h
@@ -0,0 +1,59 @@
+// ************************************************************************** //
+//
+//  BornAgain: simulate and fit scattering at grazing incidence
+//
+//! @file      FormFactors/inc/FormFactorDecoratorMaterial.h
+//! @brief     Defines class FormFactorDecoratorMaterial.
+//!
+//! @homepage  http://apps.jcns.fz-juelich.de/BornAgain
+//! @license   GNU General Public License v3 or higher (see COPYING)
+//! @copyright Forschungszentrum Jülich GmbH 2013
+//! @authors   Scientific Computing Group at MLZ Garching
+//! @authors   C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
+//
+// ************************************************************************** //
+
+#ifndef FORMFACTORDECORATORMATERIAL_H_
+#define FORMFACTORDECORATORMATERIAL_H_
+
+#include "FormFactorDecoratorFactor.h"
+#include "HomogeneousMaterial.h"
+
+//! Decorates a scalar form factor with the correct factor for the material's
+//! refractive index and that of its surrounding material
+
+class FormFactorDecoratorMaterial : public FormFactorDecoratorFactor
+{
+public:
+    FormFactorDecoratorMaterial(IFormFactor *p_form_factor,
+            complex_t wavevector_scattering_factor=1.0);
+    virtual ~FormFactorDecoratorMaterial();
+
+    virtual FormFactorDecoratorMaterial *clone() const;
+
+    //! Sets the material of the scatterer
+    virtual void setMaterial(const IMaterial *p_material);
+
+    //! Retrieves the refractive index of the ambient material
+    virtual complex_t getAmbientRefractiveIndex() const;
+
+#ifndef GCCXML_SKIP_THIS
+    //! Returns scattering amplitude for matrix interactions
+    virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
+#endif
+
+    //! Sets the ambient material
+    virtual void setAmbientMaterial(const IMaterial *p_material);
+private:
+    complex_t getRefractiveIndexFactor() const;
+
+    complex_t m_wavevector_scattering_factor;
+    const IMaterial *mp_material;
+    const IMaterial *mp_ambient_material;
+};
+
+#endif /* FORMFACTORDECORATORMATERIAL_H_ */
+
+
diff --git a/Core/FormFactors/inc/FormFactorDecoratorMultiPositionFactor.h b/Core/FormFactors/inc/FormFactorDecoratorMultiPositionFactor.h
index 6fd2ae24000b01d9257d4f40e2b664f72b54594f..8131b5aa5b4b3c778c71c6656d193d52e36abe4e 100644
--- a/Core/FormFactors/inc/FormFactorDecoratorMultiPositionFactor.h
+++ b/Core/FormFactors/inc/FormFactorDecoratorMultiPositionFactor.h
@@ -18,56 +18,34 @@
 
 #include "IFormFactorDecorator.h"
 
-//! ?
+//! Form factor for the same particle at different fixed positions
 
 class FormFactorDecoratorMultiPositionFactor : public IFormFactorDecorator
 {
- public:
-    FormFactorDecoratorMultiPositionFactor(const IFormFactor& form_factor, std::vector<kvector_t> positions);
+public:
+    FormFactorDecoratorMultiPositionFactor(const IFormFactor& form_factor,
+            std::vector<kvector_t> positions);
     virtual ~FormFactorDecoratorMultiPositionFactor() {}
     virtual FormFactorDecoratorMultiPositionFactor *clone() const;
 
-    virtual complex_t evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const;
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
+
+#ifndef GCCXML_SKIP_THIS
+    virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
+#endif
 
     virtual int getNumberOfStochasticParameters() const {
         return mp_form_factor->getNumberOfStochasticParameters();
     }
 
- private:
+private:
     complex_t getPositionsFactor(cvector_t q) const;
     std::vector<kvector_t> m_positions;
 };
 
-inline FormFactorDecoratorMultiPositionFactor::FormFactorDecoratorMultiPositionFactor(
-        const IFormFactor& form_factor, std::vector<kvector_t> positions)
-: IFormFactorDecorator(form_factor.clone())
-, m_positions(positions)
-{
-    setName("FormFactorDecoratorMultiPositionFactor");
-}
-
-inline FormFactorDecoratorMultiPositionFactor* FormFactorDecoratorMultiPositionFactor::clone() const
-{
-    return new FormFactorDecoratorMultiPositionFactor(*mp_form_factor, m_positions);
-}
-
-inline complex_t FormFactorDecoratorMultiPositionFactor::evaluate(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
-{
-    cvector_t q = k_i - k_f_bin.getMidPoint();
-    return getPositionsFactor(q)*mp_form_factor->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
-}
-
-inline complex_t FormFactorDecoratorMultiPositionFactor::getPositionsFactor(cvector_t q) const
-{
-    complex_t result;
-    for (size_t i=0; i<m_positions.size(); ++i) {
-        complex_t qr = q.x()*m_positions[i].x() + q.y()*m_positions[i].y() + q.z()*m_positions[i].z();
-        result += std::exp(complex_t(0.0, 1.0)*qr);
-    }
-    return result;
-}
-
 #endif /* FORMFACTORDECORATORMULTIPOSITIONFACTOR_H_ */
 
 
diff --git a/Core/FormFactors/inc/FormFactorDecoratorPositionFactor.h b/Core/FormFactors/inc/FormFactorDecoratorPositionFactor.h
index 10ac20233ad242c784c07818d77392223ddd71c7..00063b69e1587cfb72caa9906557c9573f9dda5a 100644
--- a/Core/FormFactors/inc/FormFactorDecoratorPositionFactor.h
+++ b/Core/FormFactors/inc/FormFactorDecoratorPositionFactor.h
@@ -19,22 +19,32 @@
 #include "Types.h"
 #include "IFormFactorDecorator.h"
 
-//! ?
+//! Decorates a form factor with a position dependent phase factor
 
 class FormFactorDecoratorPositionFactor : public IFormFactorDecorator
 {
- public:
-    FormFactorDecoratorPositionFactor(const IFormFactor& form_factor, kvector_t position);
+public:
+    FormFactorDecoratorPositionFactor(const IFormFactor& form_factor,
+            kvector_t position);
     virtual ~FormFactorDecoratorPositionFactor() {}
     virtual FormFactorDecoratorPositionFactor *clone() const;
 
-    virtual complex_t evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const;
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
+
+#ifndef GCCXML_SKIP_THIS
+    virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
+#endif
 
     virtual int getNumberOfStochasticParameters() const {
         return mp_form_factor->getNumberOfStochasticParameters();
     }
- protected:
+protected:
     kvector_t m_position;
+private:
+    complex_t getPositionFactor(cvector_t q) const;
 };
 
 inline FormFactorDecoratorPositionFactor::FormFactorDecoratorPositionFactor(
@@ -45,18 +55,37 @@ inline FormFactorDecoratorPositionFactor::FormFactorDecoratorPositionFactor(
     setName("FormFactorDecoratorPositionFactor");
 }
 
-inline FormFactorDecoratorPositionFactor* FormFactorDecoratorPositionFactor::clone() const
+inline FormFactorDecoratorPositionFactor*
+FormFactorDecoratorPositionFactor::clone() const
 {
     return new FormFactorDecoratorPositionFactor(*mp_form_factor, m_position);
 }
 
-inline complex_t FormFactorDecoratorPositionFactor::evaluate(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
+inline complex_t FormFactorDecoratorPositionFactor::evaluate(
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
+{
+    cvector_t q = k_i - k_f_bin.getMidPoint();
+    complex_t pos_factor = getPositionFactor(q);
+    return pos_factor*mp_form_factor->evaluate(k_i, k_f_bin, alpha_f_bin);
+}
+
+inline Eigen::Matrix2cd FormFactorDecoratorPositionFactor::evaluatePol(
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+        Bin1D phi_f_bin) const
 {
     cvector_t q = k_i - k_f_bin.getMidPoint();
-    complex_t qr = q.x()*m_position.x() + q.y()*m_position.y() + q.z()*m_position.z();
+    complex_t pos_factor = getPositionFactor(q);
+    return pos_factor*mp_form_factor->evaluatePol(k_i, k_f_bin, alpha_f_bin,
+            phi_f_bin);
+}
+
+inline complex_t FormFactorDecoratorPositionFactor::getPositionFactor(
+        cvector_t q) const
+{
+    complex_t qr = q.x()*m_position.x() + q.y()*m_position.y()
+            + q.z()*m_position.z();
     complex_t pos_factor = std::exp(complex_t(0.0, 1.0)*qr);
-    return pos_factor*mp_form_factor->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+    return pos_factor;
 }
 
 #endif /* FORMFACTORDECORATORPOSITIONFACTOR_H_ */
diff --git a/Core/FormFactors/inc/FormFactorDecoratorRefractiveIndex.h b/Core/FormFactors/inc/FormFactorDecoratorRefractiveIndex.h
deleted file mode 100644
index c6ea38dccbc4f2d8361a204e8d96eec96c2fcf51..0000000000000000000000000000000000000000
--- a/Core/FormFactors/inc/FormFactorDecoratorRefractiveIndex.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// ************************************************************************** //
-//
-//  BornAgain: simulate and fit scattering at grazing incidence
-//
-//! @file      FormFactors/inc/FormFactorDecoratorRefractiveIndex.h
-//! @brief     Defines class FormFactorDecoratorRefractiveIndex.
-//!
-//! @homepage  http://apps.jcns.fz-juelich.de/BornAgain
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2013
-//! @authors   Scientific Computing Group at MLZ Garching
-//! @authors   C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
-//
-// ************************************************************************** //
-
-#ifndef FORMFACTORDECORATORREFRACTIVEINDEX_H_
-#define FORMFACTORDECORATORREFRACTIVEINDEX_H_
-
-#include "FormFactorDecoratorFactor.h"
-#include "HomogeneousMaterial.h"
-
-//! Decorates a scalar form factor with the correct factor for the material's
-//! refractive index and that of its surrounding material
-
-class FormFactorDecoratorRefractiveIndex : public FormFactorDecoratorFactor
-{
- public:
-    FormFactorDecoratorRefractiveIndex(IFormFactor *p_form_factor,
-            const complex_t& refractive_index);
-    ~FormFactorDecoratorRefractiveIndex();
-
-    FormFactorDecoratorRefractiveIndex *clone() const;
-
-    virtual complex_t getAmbientRefractiveIndex() const {
-        return m_refractive_index;
-    }
-
-    virtual void setAmbientMaterial(const IMaterial *p_material);
- private:
-    complex_t getRefractiveIndexFactor(const complex_t& ambient_index,
-            const complex_t& particle_index) const;
-
-    complex_t m_refractive_index;
-};
-
-inline FormFactorDecoratorRefractiveIndex::FormFactorDecoratorRefractiveIndex(
-        IFormFactor* p_form_factor, const complex_t& refractive_index)
-: FormFactorDecoratorFactor(p_form_factor,
-        getRefractiveIndexFactor(complex_t(1.0, 0.0), refractive_index))
-, m_refractive_index(refractive_index)
-{
-    setName("FormFactorDecoratorRefractiveIndex");
-}
-
-inline FormFactorDecoratorRefractiveIndex::~FormFactorDecoratorRefractiveIndex()
-{
-}
-
-inline FormFactorDecoratorRefractiveIndex* FormFactorDecoratorRefractiveIndex::clone() const
-{
-    FormFactorDecoratorRefractiveIndex *result =
-            new FormFactorDecoratorRefractiveIndex(mp_form_factor->clone(), m_refractive_index);
-    result->m_factor = m_factor;
-    result->setName(getName());
-    return result;
-}
-
-inline void FormFactorDecoratorRefractiveIndex::setAmbientMaterial(
-        const IMaterial *p_material)
-{
-    complex_t ambient_refractive_index(1.0, 0.0);
-    if (p_material) {
-        ambient_refractive_index = p_material->getRefractiveIndex();
-    }
-    m_factor = getRefractiveIndexFactor(ambient_refractive_index, m_refractive_index);
-}
-
-inline complex_t FormFactorDecoratorRefractiveIndex::getRefractiveIndexFactor(
-        const complex_t& ambient_index, const complex_t& particle_index) const
-{
-    return (ambient_index*ambient_index - particle_index*particle_index);
-}
-
-#endif /* FORMFACTORDECORATORREFRACTIVEINDEX_H_ */
-
-
diff --git a/Core/FormFactors/inc/FormFactorDecoratorTransformation.h b/Core/FormFactors/inc/FormFactorDecoratorTransformation.h
index cb5fa3dd66944c8070ec34129c7726ca6704b047..204462cf7c43122a2b7aa3af66c5f2eec5b93a02 100644
--- a/Core/FormFactors/inc/FormFactorDecoratorTransformation.h
+++ b/Core/FormFactors/inc/FormFactorDecoratorTransformation.h
@@ -23,8 +23,8 @@
 
 class FormFactorDecoratorTransformation : public IFormFactorDecorator
 {
- public:
-    //! Constructor, setting formfactor and rotation.
+public:
+    //! Constructor, setting form factor and rotation.
     FormFactorDecoratorTransformation(
         IFormFactor *p_form_factor, const Geometry::PTransform3D& transform)
         : IFormFactorDecorator(p_form_factor)
@@ -38,22 +38,20 @@ class FormFactorDecoratorTransformation : public IFormFactorDecorator
 
     virtual FormFactorDecoratorTransformation *clone() const;
 
-    virtual complex_t evaluate(
-        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-        double alpha_i, double alpha_f) const;
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
 
     virtual int getNumberOfStochasticParameters() const
     { return mp_form_factor->getNumberOfStochasticParameters(); }
 
- protected:
+protected:
     Geometry::PTransform3D mP_transform;
     Geometry::PTransform3D mP_inverse_transform;
 };
 
 
 inline complex_t FormFactorDecoratorTransformation::evaluate(
-    const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-    double alpha_i, double alpha_f) const
+    const cvector_t& k_i, const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
     cvector_t new_ki =
         mP_inverse_transform->transformed(k_i);
@@ -62,7 +60,7 @@ inline complex_t FormFactorDecoratorTransformation::evaluate(
     cvector_t new_kf_upper =
         mP_inverse_transform->transformed(k_f_bin.m_q_upper);
     Bin1DCVector new_kf_bin(new_kf_lower, new_kf_upper);
-    return mp_form_factor->evaluate(new_ki, new_kf_bin, alpha_i, alpha_f);
+    return mp_form_factor->evaluate(new_ki, new_kf_bin, alpha_f_bin);
 }
 
 #endif // FORMFACTORDECORATORTRANSFORMATION_H
diff --git a/Core/FormFactors/inc/FormFactorEllipsoid.h b/Core/FormFactors/inc/FormFactorEllipsoid.h
index aa8705f5835c1fdd88acc0b9d0982202e01b71fb..5069300f7d44b385cb3f9553e59b3f74f2991da0 100644
--- a/Core/FormFactors/inc/FormFactorEllipsoid.h
+++ b/Core/FormFactors/inc/FormFactorEllipsoid.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorEllipsoid : public IFormFactorBorn
 {
- public:
+public:
     FormFactorEllipsoid(double radius, double width,
                         double height, double alpha);
     ~FormFactorEllipsoid() {}
@@ -47,11 +47,11 @@ class BA_CORE_API_ FormFactorEllipsoid : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 
- private:
+private:
     double m_radius;
     double m_width;
     double m_height;
diff --git a/Core/FormFactors/inc/FormFactorFullSphere.h b/Core/FormFactors/inc/FormFactorFullSphere.h
index 7317c9c70bd8a391c408e5cda265b11ed368bdf2..46d444e8a2c41175b2e59d4e8628a8cff85339b9 100644
--- a/Core/FormFactors/inc/FormFactorFullSphere.h
+++ b/Core/FormFactors/inc/FormFactorFullSphere.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorFullSphere : public IFormFactorBorn
 {
- public:
+public:
     FormFactorFullSphere(double radius);
     ~FormFactorFullSphere() {}
     virtual FormFactorFullSphere *clone() const;
@@ -41,10 +41,10 @@ class BA_CORE_API_ FormFactorFullSphere : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     virtual void init_parameters();
 
- private:
+private:
     double m_radius;
 };
 
diff --git a/Core/FormFactors/inc/FormFactorFullSpheroid.h b/Core/FormFactors/inc/FormFactorFullSpheroid.h
index fe3827b489375f6c175882a8d3df3df6de51b71a..e5d60efe9fc0028fe727a26ec552b13d7720632c 100644
--- a/Core/FormFactors/inc/FormFactorFullSpheroid.h
+++ b/Core/FormFactors/inc/FormFactorFullSpheroid.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorFullSpheroid : public IFormFactorBorn
 {
- public:
+public:
     FormFactorFullSpheroid(double radius, double height);
     double FullSpheroidIntegral(double Z, void* params) const;
     ~FormFactorFullSpheroid() {}
@@ -35,11 +35,11 @@ class BA_CORE_API_ FormFactorFullSpheroid : public IFormFactorBorn
 
     virtual double getHeight() const { return m_height; }
 
- protected:
+protected:
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
     virtual void init_parameters();
 
- private:
+private:
     double evaluate_for_q_real() const;
     complex_t evaluate_for_q_imag() const;
     double FullSpheroidIntegralReal(double Z, void* params) const;
diff --git a/Core/FormFactors/inc/FormFactorGauss.h b/Core/FormFactors/inc/FormFactorGauss.h
index 73a13711f8e84c8094a20e204ef6add327fecff9..9e3a41cf6c7deb4fde58e85445948ab31e961338 100644
--- a/Core/FormFactors/inc/FormFactorGauss.h
+++ b/Core/FormFactors/inc/FormFactorGauss.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorGauss : public IFormFactorBorn
 {
- public:
+public:
     FormFactorGauss(double volume);
     FormFactorGauss(double height, double width);
     ~FormFactorGauss() {}
@@ -35,11 +35,11 @@ class BA_CORE_API_ FormFactorGauss : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 
- private:
+private:
     double m_height;
     double m_width;
 };
diff --git a/Core/FormFactors/inc/FormFactorHemiSpheroid.h b/Core/FormFactors/inc/FormFactorHemiSpheroid.h
index 8695340ef3c9dc41de820d73ae57ce940e25f3dd..32ea915e700a0c01389641d2bb93812f22afcc3e 100644
--- a/Core/FormFactors/inc/FormFactorHemiSpheroid.h
+++ b/Core/FormFactors/inc/FormFactorHemiSpheroid.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorHemiSpheroid : public IFormFactorBorn
 {
- public:
+public:
     //! @brief Cone constructor
     //! @param height of Conee
     //! @param radius half of Cone's base
@@ -40,10 +40,10 @@ class BA_CORE_API_ FormFactorHemiSpheroid : public IFormFactorBorn
 
     virtual double getHeight() const { return m_height; }
 
- protected:
+protected:
     virtual complex_t evaluate_for_q (const cvector_t& q) const;
 
- private:
+private:
     double evaluate_for_q_real() const;
     double evaluate_for_q_imag() const;
     double HemiSpheroidIntegralReal(double Z, void* params) const;
diff --git a/Core/FormFactors/inc/FormFactorLorentz.h b/Core/FormFactors/inc/FormFactorLorentz.h
index fe52b800afba8a692917da289dc0209d5765d5da..52a6b3b3bf1c5d7f8b437903b98ad79f73ded99b 100644
--- a/Core/FormFactors/inc/FormFactorLorentz.h
+++ b/Core/FormFactors/inc/FormFactorLorentz.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorLorentz : public IFormFactorBorn
 {
- public:
+public:
     FormFactorLorentz(double volume);
     FormFactorLorentz(double height, double width);
     ~FormFactorLorentz() {}
@@ -35,11 +35,11 @@ class BA_CORE_API_ FormFactorLorentz : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 
- private:
+private:
     double m_height;
     double m_width;
 };
diff --git a/Core/FormFactors/inc/FormFactorParallelepiped.h b/Core/FormFactors/inc/FormFactorParallelepiped.h
index 55d00da6e2e5ecc5696d317bad3e1701c5857913..7eff5d698e60b7261aed4666906a4be2fb4e3ef0 100644
--- a/Core/FormFactors/inc/FormFactorParallelepiped.h
+++ b/Core/FormFactors/inc/FormFactorParallelepiped.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorParallelepiped : public IFormFactorBorn
 {
- public:
+public:
     FormFactorParallelepiped(double height, double radius);
     ~FormFactorParallelepiped() {}
     virtual FormFactorParallelepiped *clone() const;
@@ -42,10 +42,10 @@ class BA_CORE_API_ FormFactorParallelepiped : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     virtual void init_parameters();
 
- private:
+private:
     double m_height;
     double m_radius;
 };
diff --git a/Core/FormFactors/inc/FormFactorPol.h b/Core/FormFactors/inc/FormFactorPol.h
deleted file mode 100644
index fc78f1e68fb6f47ac59079389fef5f6e634198fb..0000000000000000000000000000000000000000
--- a/Core/FormFactors/inc/FormFactorPol.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// ************************************************************************** //
-//
-//  BornAgain: simulate and fit scattering at grazing incidence
-//
-//! @file      FormFactors/inc/FormFactorPol.h
-//! @brief     Defines class FormFactorPol.
-//!
-//! @homepage  http://apps.jcns.fz-juelich.de/BornAgain
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2013
-//! @authors   Scientific Computing Group at MLZ Garching
-//! @authors   C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
-//
-// ************************************************************************** //
-
-#ifndef FORMFACTORPOL_H_
-#define FORMFACTORPOL_H_
-
-#include "IFormFactorDecorator.h"
-#include "LayerSpecularInfo.h"
-
-#include <Eigen/Core>
-
-//! Evaluates a polarized form factor (which is a 2x2 matrix)
-
-class BA_CORE_API_ FormFactorPol : public IFormFactorDecorator
-{
-public:
-    FormFactorPol(IFormFactor *p_formfactor)
-        : IFormFactorDecorator(p_formfactor)
-        , mp_specular_info(0), mp_material(0), mp_ambient_material(0) {}
-    virtual ~FormFactorPol();
-
-    virtual FormFactorPol *clone() const;
-
-    // Forwards to the evaluate function of the embedded form factor
-    virtual complex_t evaluate(const cvector_t& k_i,
-            const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const;
-
-    //! Calculates and returns a polarized form factor calculation in DWBA
-    virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
-            const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-            double alpha_i, double alpha_f, double phi_f) const;
-
-    //! Sets magnetic reflection/transmission info for polarized DWBA
-    void setSpecularInfo(const LayerSpecularInfo& layer_specular_info);
-
-    //! Sets the material of the scatterer
-    void setMaterial(const IMaterial *p_material) {
-        mp_material = p_material;
-    }
-
-    //! Sets the material of the surrounding structure
-    virtual void setAmbientMaterial(const IMaterial *p_material) {
-        mp_ambient_material = p_material;
-    }
-protected:
-    const ILayerRTCoefficients *getOutCoeffs(double alpha_f,
-            double phi_f) const;
-    LayerSpecularInfo *mp_specular_info;
-    const IMaterial *mp_material;
-    const IMaterial *mp_ambient_material;
-};
-
-inline const ILayerRTCoefficients *FormFactorPol::getOutCoeffs(
-        double alpha_f, double phi_f) const
-{
-    return mp_specular_info->getOutCoefficients(alpha_f, phi_f);
-}
-
-#endif /* FORMFACTORPOL_H_ */
diff --git a/Core/FormFactors/inc/FormFactorPrism3.h b/Core/FormFactors/inc/FormFactorPrism3.h
index 485b1e6a3d2b866c10395c22947d56dca51b37e5..a188cdc584a2a45635485abef127766edae899f3 100644
--- a/Core/FormFactors/inc/FormFactorPrism3.h
+++ b/Core/FormFactors/inc/FormFactorPrism3.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorPrism3 : public IFormFactorBorn
 {
- public:
+public:
     FormFactorPrism3(double height, double half_side);
     ~FormFactorPrism3() {}
     virtual FormFactorPrism3 *clone() const;
@@ -40,10 +40,10 @@ class BA_CORE_API_ FormFactorPrism3 : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     virtual void init_parameters();
 
- private:
+private:
     double m_height;
     double m_half_side;  
     double m_root3; // Cached value of square root of 3
diff --git a/Core/FormFactors/inc/FormFactorPrism6.h b/Core/FormFactors/inc/FormFactorPrism6.h
index eec8e1ff0451d85be089276b77a9cb913d17cd87..4a2e8a804d930a3e6ed186369cfb6566753542bc 100644
--- a/Core/FormFactors/inc/FormFactorPrism6.h
+++ b/Core/FormFactors/inc/FormFactorPrism6.h
@@ -21,7 +21,7 @@
 
 class BA_CORE_API_ FormFactorPrism6 : public IFormFactorBorn
 {
- public:
+public:
     FormFactorPrism6(double height, double half_side);
     ~FormFactorPrism6() {}
     virtual FormFactorPrism6 *clone() const;
@@ -34,10 +34,10 @@ class BA_CORE_API_ FormFactorPrism6 : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:  
+protected:  
     virtual void init_parameters();
 
- private:
+private:
     double m_height;
     double m_half_side;
     double m_root3; // Cached value of square root of 3
diff --git a/Core/FormFactors/inc/FormFactorPyramid.h b/Core/FormFactors/inc/FormFactorPyramid.h
index dfa9096876df717535bde3b5fee6d9c3f29a2246..ff6f6aa98da5d3a3e2f743fc43f84efc45140532 100644
--- a/Core/FormFactors/inc/FormFactorPyramid.h
+++ b/Core/FormFactors/inc/FormFactorPyramid.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ FormFactorPyramid : public IFormFactorBorn
 {
- public:
+public:
     //! @brief pyramid constructor
     //! @param height of pyramide
     //! @param half_side half of pyramid's base
@@ -48,10 +48,10 @@ class BA_CORE_API_ FormFactorPyramid : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     virtual void init_parameters();
 
- private:
+private:
     double m_height;
     double m_half_side;
     double m_alpha;
diff --git a/Core/FormFactors/inc/FormFactorSphere.h b/Core/FormFactors/inc/FormFactorSphere.h
index c8024f67ce8ef6426f0a2573d73e20d8c24fd1a2..317cc92ce086522e47e99503ae797a5c5ea8e9d0 100644
--- a/Core/FormFactors/inc/FormFactorSphere.h
+++ b/Core/FormFactors/inc/FormFactorSphere.h
@@ -24,7 +24,7 @@
 
 class BA_CORE_API_ FormFactorSphere : public IFormFactorBorn
 {
- public:
+public:
     FormFactorSphere(double radius, double height);
 
     ~FormFactorSphere() { delete m_integrator; }
@@ -37,10 +37,10 @@ class BA_CORE_API_ FormFactorSphere : public IFormFactorBorn
 
     virtual double getHeight() const { return m_height; }
 
- protected:
+protected:
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- private:
+private:
     complex_t Integrand(double Z, void* params) const;
 
     virtual void init_parameters();
diff --git a/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h b/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h
index 91f3202ec2d224f6f06bcd249736d2b66b1f9795..eca022fc44a54ead8caafe707148d6069e27cd8a 100644
--- a/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h
+++ b/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h
@@ -25,7 +25,7 @@
 
 class BA_CORE_API_ FormFactorSphereGaussianRadius : public IFormFactorBorn
 {
- public:
+public:
     FormFactorSphereGaussianRadius(double mean, double sigma);
     virtual FormFactorSphereGaussianRadius *clone() const;
     virtual ~FormFactorSphereGaussianRadius();
@@ -42,7 +42,7 @@ class BA_CORE_API_ FormFactorSphereGaussianRadius : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- private:
+private:
     double calculateMeanR3() const;
 
     double m_mean; //!< This is the mean radius
diff --git a/Core/FormFactors/inc/FormFactorTethraedron.h b/Core/FormFactors/inc/FormFactorTethraedron.h
index 78815d96458be13b74a6db7218719b554577cf3f..57c07159fd1bac337bee6cb150a35367cf63bed9 100644
--- a/Core/FormFactors/inc/FormFactorTethraedron.h
+++ b/Core/FormFactors/inc/FormFactorTethraedron.h
@@ -24,7 +24,7 @@
 
 class BA_CORE_API_ FormFactorTethraedron : public IFormFactorBorn
 {
- public:
+public:
     //! @brief tethraedron constructor
     //! @param height of tethraedron
     //! @param half_side half of tethraedron's base
@@ -42,10 +42,10 @@ class BA_CORE_API_ FormFactorTethraedron : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     virtual void init_parameters();
 
- private:
+private:
     double m_height;
     double m_half_side;
     double m_alpha;
diff --git a/Core/FormFactors/inc/FormFactorWeighted.h b/Core/FormFactors/inc/FormFactorWeighted.h
index 9f1db2d7322b04c98352f64871b64adcc6be301b..97f97161478bb8170b57b5eafb51521a1ef74a8c 100644
--- a/Core/FormFactors/inc/FormFactorWeighted.h
+++ b/Core/FormFactors/inc/FormFactorWeighted.h
@@ -18,11 +18,12 @@
 
 #include "IFormFactor.h"
 
-//! ?
+//! Coherent sum of different form factors with different weights
+//! (for scalar form factors)
 
 class FormFactorWeighted : public IFormFactor
 {
- public:
+public:
     FormFactorWeighted();
     virtual ~FormFactorWeighted();
     virtual FormFactorWeighted *clone() const;
@@ -31,11 +32,17 @@ class FormFactorWeighted : public IFormFactor
 
     virtual void setAmbientMaterial(const IMaterial *p_material);
 
-    virtual complex_t evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const;
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
+
+    //! Calculates and returns a polarized form factor calculation in DWBA
+    virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
 
     virtual int getNumberOfStochasticParameters() const;
 
- protected:
+protected:
     std::vector<IFormFactor *> m_form_factors;
     std::vector<double> m_weights;
 };
diff --git a/Core/FormFactors/inc/FormFactors.h b/Core/FormFactors/inc/FormFactors.h
index b60d458011a218372c6b7b0f89155cb11ab97c18..d2d0426fae700343156959fcc95da7a5476ecb14 100644
--- a/Core/FormFactors/inc/FormFactors.h
+++ b/Core/FormFactors/inc/FormFactors.h
@@ -24,7 +24,7 @@
 #include "FormFactorDecoratorFactor.h"
 #include "FormFactorDecoratorMultiPositionFactor.h"
 #include "FormFactorDecoratorPositionFactor.h"
-#include "FormFactorDecoratorRefractiveIndex.h"
+#include "FormFactorDecoratorMaterial.h"
 #include "FormFactorDecoratorTransformation.h"
 #include "FormFactorDWBA.h"
 #include "FormFactorDWBAConstZ.h"
diff --git a/Core/FormFactors/inc/IFormFactor.h b/Core/FormFactors/inc/IFormFactor.h
index 253e634407a35bcba08142ef80464218db34e865..199515bb17c103138b6866309645f6d4d8ca56de 100644
--- a/Core/FormFactors/inc/IFormFactor.h
+++ b/Core/FormFactors/inc/IFormFactor.h
@@ -21,22 +21,28 @@
 #include "ISample.h"
 #include "Bin.h"
 
-//! The basic interface for formfactors.
+#ifndef GCCXML_SKIP_THIS
+#include <Eigen/Core>
+#endif
+
+//! The basic interface for form factors.
 
 class BA_CORE_API_ IFormFactor : public ISample
 {
- public:
+public:
     IFormFactor() {}
     virtual ~IFormFactor() {}
 
     virtual IFormFactor *clone() const=0;
 
     //! Calls the ISampleVisitor's visit method
-    virtual void accept(ISampleVisitor *p_visitor) const { p_visitor->visit(this); }
+    virtual void accept(ISampleVisitor *p_visitor) const {
+        p_visitor->visit(this);
+    }
 
-    //! Passes the refractive index of the ambient material in which this particle is embedded.
-    virtual void setAmbientMaterial(const IMaterial *p_material)
-    {
+    //! Passes the refractive index of the ambient material in which this
+    //! particle is embedded.
+    virtual void setAmbientMaterial(const IMaterial *p_material) {
         (void)p_material; // to prevent unused-variable warning
     }
 
@@ -45,26 +51,40 @@ class BA_CORE_API_ IFormFactor : public ISample
     //! @param k_f_bin   outgoing wavevector bin
     //! @param alpha_i incident angle wrt scattering surface
     //! @param alpha_f outgoing angle wrt scattering surface
-    virtual complex_t evaluate(
-        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-        double alpha_i, double alpha_f) const=0;
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const=0;
+
+#ifndef GCCXML_SKIP_THIS
+    //! Returns scattering amplitude for matrix interactions
+    //! @param k_i   incoming wavevector
+    //! @param k_f1_bin   outgoing wavevector bin for first eigenmode
+    //! @param k_f2_bin   outgoing wavevector bin for second eigenmode
+    //! @param alpha_i incident inclination angle wrt scattering surface
+    //! @param alpha_f outgoing inclination angle wrt scattering surface
+    //! @param phi_f outgoing azimuthal angle wrt scattering surface
+    virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
+#endif
 
     //! Returns number of variable/stochastic parameters
     virtual int getNumberOfStochasticParameters() const { return 0; }
 
-    //! Returns the total volume of the particle to which this formfactor belongs
+    //! Returns the total volume of the particle of this form factor's shape
     virtual double getVolume() const;
 
-    //! Returns the total height of the particle to which this formfactor belongs
+    //! Returns the total height of the particle of this form factor's shape
     virtual double getHeight() const;
 
-    //! Returns the total radial size of the particle to which this formfactor belongs
+    //! Returns the total radial size of the particle of this form factor's shape
     virtual double getRadius() const;
 
-    //! Returns true if the formfactor is constructed as an average over multiple simple ones
+    //! Returns true if the form factor is constructed as an average over
+    //! multiple simple ones
     virtual bool isDistributedFormFactor() const { return false; }
 
-    //! retrieve a list of simple formfactors and their probabilities when the formfactor is a distributed one
+    //! retrieve a list of simple form factors and their probabilities when the
+    //! form factor is a distributed one
     virtual void createDistributedFormFactors(
         std::vector<IFormFactor *>& form_factors,
         std::vector<double>& probabilities,
@@ -75,11 +95,26 @@ class BA_CORE_API_ IFormFactor : public ISample
     }
 };
 
+#ifndef GCCXML_SKIP_THIS
+inline Eigen::Matrix2cd IFormFactor::evaluatePol(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin, Bin1D phi_f_bin) const
+{
+    (void)k_i;
+    (void)k_f_bin;
+    (void)alpha_f_bin;
+    (void)phi_f_bin;
+    // Throws to prevent unanticipated behaviour
+    throw NotImplementedException("IFormFactor::evaluatePol:"
+            " is not implemented by default");
+}
+#endif
+
 inline double IFormFactor::getVolume() const
 {
-    cvector_t zero;
-    Bin1DCVector zero_bin(zero, zero);
-    return std::abs(evaluate(zero, zero_bin, 0.0, 0.0));
+    cvector_t zero_vector;
+    Bin1DCVector zero_vector_bin(zero_vector, zero_vector);
+    Bin1D zero_bin = { 0.0, 0.0 };
+    return std::abs(evaluate(zero_vector, zero_vector_bin, zero_bin));
 }
 
 inline double IFormFactor::getHeight() const
diff --git a/Core/FormFactors/inc/IFormFactorBorn.h b/Core/FormFactors/inc/IFormFactorBorn.h
index aa85144156ff4cbb50f09c43c271a0d2b8c4718f..793d28a19e34ed3428b77c27fef9349ea76e900b 100644
--- a/Core/FormFactors/inc/IFormFactorBorn.h
+++ b/Core/FormFactors/inc/IFormFactorBorn.h
@@ -18,29 +18,25 @@
 
 #include "IFormFactor.h"
 
-//! Pure virtual interface for Born formfactors (only depending on q=ki-kf).
+//! Pure virtual interface for Born form factors (only depending on q=ki-kf).
 
 class BA_CORE_API_ IFormFactorBorn : public IFormFactor
 {
- public:
+public:
     IFormFactorBorn() {}
     virtual ~IFormFactorBorn() {}
     virtual IFormFactorBorn *clone() const=0;
 
     virtual void accept(ISampleVisitor *visitor) const { visitor->visit(this); }
 
-    virtual complex_t evaluate(
-        const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-        double alpha_i, double alpha_f) const
-    {
-        (void)alpha_i;  // to avoid unused-variable warning
-        (void)alpha_f;  // to avoid unused-variable warning
-        Bin1DCVector q_bin(k_i - k_f_bin.m_q_lower, k_i - k_f_bin.m_q_upper);
-        if (useLargeBinApproximation(q_bin)) {
-            return getVolume()*bigZPart(q_bin)*bigRadialPart(q_bin);
-        }
-        return evaluate_for_q(q_bin.getMidPoint());
-    }
+    virtual complex_t evaluate(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const;
+
+#ifndef GCCXML_SKIP_THIS
+    virtual Eigen::Matrix2cd evaluatePol(const cvector_t& k_i,
+            const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+            Bin1D phi_f_bin) const;
+#endif
 
     //! evaluate scattering amplitude for complex wavevector
     //! @param q  wavevector transfer \f$q\equiv k_i-k_f\f$
@@ -48,36 +44,21 @@ class BA_CORE_API_ IFormFactorBorn : public IFormFactor
 
     //! Returns volume.
 
-    //! Default implementation: formfactor at q=0.
+    //! Default implementation: form factor at q=0.
     //! Overload this for more efficient implementation
     //! (or to avoid endless loop caused by big bin approximation).
-    //!
-    virtual double getVolume() const {
-        cvector_t zero;
-        return std::abs(evaluate_for_q(zero));
-    }
+    virtual double getVolume() const;
 
- protected:
+protected:
     //! Returns radial part of scattering amplitude for large bins
     double bigRadialPart(const Bin1DCVector& q_bin) const;
 
     //! Returns z-part of scattering amplitude for large bins
     complex_t bigZPart(const Bin1DCVector& q_bin) const;
 
- private:
+private:
     //! determine if a large bin size approximation should be used
-    bool useLargeBinApproximation(const Bin1DCVector& q_bin) const
-    {
-        double delta_qr = std::abs( q_bin.getDelta().magxy() );
-        double delta_qz = std::abs( q_bin.getDelta().z() );
-        if (delta_qr == 0 || delta_qz == 0)
-            return false;
-        if ( delta_qr > M_PI/2/getRadius() )
-            return true;
-        if ( delta_qz > M_PI/2/getHeight() )
-            return true;
-        return false;
-    }
+    bool useLargeBinApproximation(const Bin1DCVector& q_bin) const;
 
     //! approximate intensity that does not contain rapid oscillations
     double bigRadialIntegrand(double qR, void *params) const;
@@ -86,34 +67,6 @@ class BA_CORE_API_ IFormFactorBorn : public IFormFactor
     double bigZPartIntegral(double qH2) const;
 };
 
-
-//inline complex_t IFormFactorBorn::evaluate(
-//    const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-//    double alpha_i, double alpha_f) const
-//{
-//    (void)alpha_i;  // to avoid unused-variable warning
-//    (void)alpha_f;  // to avoid unused-variable warning
-//    Bin1DCVector q_bin(k_i - k_f_bin.m_q_lower, k_i - k_f_bin.m_q_upper);
-//    if (useLargeBinApproximation(q_bin)) {
-//        return getVolume()*bigZPart(q_bin)*bigRadialPart(q_bin);
-//    }
-//    return evaluate_for_q(q_bin.getMidPoint());
-//}
-
-//inline bool IFormFactorBorn::useLargeBinApproximation(
-//    const Bin1DCVector& q_bin) const
-//{
-//    double delta_qr = std::abs( q_bin.getDelta().magxy() );
-//    double delta_qz = std::abs( q_bin.getDelta().z() );
-//    if (delta_qr == 0 || delta_qz == 0)
-//        return false;
-//    if ( delta_qr > M_PI/2/getRadius() )
-//        return true;
-//    if ( delta_qz > M_PI/2/getHeight() )
-//        return true;
-//    return false;
-//}
-
 #endif /* IFORMFACTORBORN_H_ */
 
 
diff --git a/Core/FormFactors/inc/IFormFactorBornSeparable.h b/Core/FormFactors/inc/IFormFactorBornSeparable.h
index 4b937b9e418a9d26d2840edf327d6a12f1b912d2..cd73791c259a580e8307aac5f95ebc3460457e96 100644
--- a/Core/FormFactors/inc/IFormFactorBornSeparable.h
+++ b/Core/FormFactors/inc/IFormFactorBornSeparable.h
@@ -22,7 +22,7 @@
 
 class IFormFactorBornSeparable : public IFormFactorBorn
 {
- public:
+public:
     IFormFactorBornSeparable();
     virtual ~IFormFactorBornSeparable() {}
     virtual IFormFactorBornSeparable *clone() const=0;
@@ -31,7 +31,7 @@ class IFormFactorBornSeparable : public IFormFactorBorn
 
     virtual complex_t evaluate_for_q(const cvector_t& q) const;
 
- protected:
+protected:
     //! evaluate radial part of scattering amplitude for complex wavevector
     virtual complex_t evaluate_for_q_radial(const cvector_t& q) const=0;
 
diff --git a/Core/FormFactors/src/FormFactorCrystal.cpp b/Core/FormFactors/src/FormFactorCrystal.cpp
index b598b56ec76d73a7886d36bcacec1fbe2ceed7e0..606e247005347591ee671e42ea9000efe49c31c4 100644
--- a/Core/FormFactors/src/FormFactorCrystal.cpp
+++ b/Core/FormFactors/src/FormFactorCrystal.cpp
@@ -18,14 +18,16 @@
 FormFactorCrystal::FormFactorCrystal(
         const Crystal& p_crystal,
         const IFormFactor& meso_crystal_form_factor,
-        const IMaterial *p_material)
+        const IMaterial *p_material, complex_t wavevector_scattering_factor)
 : m_lattice(p_crystal.getLattice())
+, m_wavevector_scattering_factor(wavevector_scattering_factor)
 , mp_ambient_material(p_material)
 , m_max_rec_length(0.0)
 {
     setName("FormFactorCrystal");
     mp_particle = p_crystal.createBasis();
-    mp_basis_form_factor = mp_particle->createFormFactor();
+    mp_basis_form_factor = mp_particle->createFormFactor(
+            m_wavevector_scattering_factor);
     mp_meso_form_factor = meso_crystal_form_factor.clone();
     setAmbientMaterial(mp_ambient_material);
     calculateLargestReciprocalDistance();
@@ -42,7 +44,8 @@ FormFactorCrystal* FormFactorCrystal::clone() const
 {
     Crystal np_crystal(*mp_particle, m_lattice);
     FormFactorCrystal *result = new FormFactorCrystal(np_crystal,
-            *mp_meso_form_factor, mp_ambient_material);
+            *mp_meso_form_factor, mp_ambient_material,
+            m_wavevector_scattering_factor);
     result->setName(getName());
     return result;
 }
@@ -56,14 +59,13 @@ void FormFactorCrystal::setAmbientMaterial(const IMaterial *p_material)
 complex_t FormFactorCrystal::evaluate_for_q(const cvector_t& q) const
 {
     (void)q;
-    throw LogicErrorException("evaluate_for_q() should never be called explicitly for FormFactorCrystal");
+    throw LogicErrorException("evaluate_for_q() should never be called"
+            " explicitly for FormFactorCrystal");
 }
 
 complex_t FormFactorCrystal::evaluate(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
-    (void)alpha_i;
-    (void)alpha_f;
     // construct a real reciprocal vector
     Bin1DCVector q_bin(k_i - k_f_bin.m_q_lower, k_i - k_f_bin.m_q_upper);
     cvector_t q = q_bin.getMidPoint();
@@ -71,25 +73,60 @@ complex_t FormFactorCrystal::evaluate(const cvector_t& k_i,
     cvector_t k_zero;
     // calculate the used radius in function of the reciprocal lattice scale
     double radius = 1.1*m_max_rec_length;
-    // retrieve nearest reciprocal lattice vectors
-//    std::vector<kvector_t> rec_vectors =
-//            m_lattice.getReciprocalLatticeVectorsWithinRadius(q_real, radius);
 
+    // retrieve nearest reciprocal lattice vectors
     m_lattice.computeReciprocalLatticeVectorsWithinRadius(q_real, radius);
     const KVectorContainer& rec_vectors = m_lattice.getKVectorContainer();
 
     // perform convolution on these lattice vectors
     complex_t result(0.0, 0.0);
-    //for (std::vector<kvector_t>::const_iterator it = rec_vectors.begin(); it != rec_vectors.end(); ++it) {
-    for (KVectorContainer::const_iterator it = rec_vectors.begin(); it != rec_vectors.end(); ++it) {
+    for (KVectorContainer::const_iterator it = rec_vectors.begin();
+            it != rec_vectors.end(); ++it) {
+        cvector_t q_i((*it).x(), (*it).y(), (*it).z());
+        Bin1DCVector min_q_i_zero_bin(-q_i, -q_i);
+        Bin1DCVector q_i_min_q(q_i - q_bin.m_q_lower, q_i - q_bin.m_q_upper);
+        complex_t basis_factor = mp_basis_form_factor->evaluate(
+                k_zero, min_q_i_zero_bin, alpha_f_bin);
+        complex_t meso_factor = mp_meso_form_factor->evaluate(
+                k_zero, q_i_min_q, alpha_f_bin);
+        result += basis_factor*meso_factor;
+    }
+    // the transformed delta train gets a factor of (2pi)^3/V, but the (2pi)^3
+    // is cancelled by the convolution of Fourier transforms :
+    double volume = m_lattice.getVolume();
+    return result/volume;
+}
+
+Eigen::Matrix2cd FormFactorCrystal::evaluatePol(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin, Bin1D phi_f_bin) const
+{
+    // construct a real reciprocal vector
+    Bin1DCVector q_bin(k_i - k_f_bin.m_q_lower, k_i - k_f_bin.m_q_upper);
+    cvector_t q = q_bin.getMidPoint();
+    kvector_t q_real(q.x().real(), q.y().real(), q.z().real());
+    cvector_t k_zero;
+    // calculate the used radius in function of the reciprocal lattice scale
+    double radius = 1.1*m_max_rec_length;
+
+    // retrieve nearest reciprocal lattice vectors
+    m_lattice.computeReciprocalLatticeVectorsWithinRadius(q_real, radius);
+    const KVectorContainer& rec_vectors = m_lattice.getKVectorContainer();
+
+    // perform convolution on these lattice vectors
+    Eigen::Matrix2cd result = Eigen::Matrix2cd::Zero();
+    for (KVectorContainer::const_iterator it = rec_vectors.begin();
+            it != rec_vectors.end(); ++it) {
         cvector_t q_i((*it).x(), (*it).y(), (*it).z());
         Bin1DCVector min_q_i_zero_bin(-q_i, -q_i);
         Bin1DCVector q_i_min_q(q_i - q_bin.m_q_lower, q_i - q_bin.m_q_upper);
-        complex_t basis_factor = mp_basis_form_factor->evaluate(k_zero, min_q_i_zero_bin, 0.0, 0.0);
-        complex_t meso_factor = mp_meso_form_factor->evaluate(k_zero, q_i_min_q, 0.0, 0.0);
+        Eigen::Matrix2cd basis_factor = mp_basis_form_factor->evaluatePol(
+                k_zero, min_q_i_zero_bin, alpha_f_bin, phi_f_bin);
+        complex_t meso_factor = mp_meso_form_factor->evaluate(
+                k_zero, q_i_min_q, alpha_f_bin);
         result += basis_factor*meso_factor;
     }
-    // the transformed delta train gets a factor of (2pi)^3/V, but the (2pi)^3 is cancelled by the convolution of Fourier transforms :
+    // the transformed delta train gets a factor of (2pi)^3/V, but the (2pi)^3
+    // is cancelled by the convolution of Fourier transforms :
     double volume = m_lattice.getVolume();
     return result/volume;
 }
diff --git a/Core/FormFactors/src/FormFactorDWBA.cpp b/Core/FormFactors/src/FormFactorDWBA.cpp
index 070446480b4b06e98582b5523edf22582fed8c4f..f3af8dd5c91ad7b530432f96614eb77eef0fcbb7 100644
--- a/Core/FormFactors/src/FormFactorDWBA.cpp
+++ b/Core/FormFactors/src/FormFactorDWBA.cpp
@@ -38,9 +38,9 @@ FormFactorDWBA* FormFactorDWBA::clone() const
 }
 
 complex_t FormFactorDWBA::evaluate(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
-    calculateTerms(k_i, k_f_bin, alpha_i, alpha_f);
+    calculateTerms(k_i, k_f_bin, alpha_f_bin);
     return m_term_S + m_term_RS + m_term_SR + m_term_RSR;
 }
 
@@ -52,26 +52,39 @@ void FormFactorDWBA::setSpecularInfo(
 }
 
 void FormFactorDWBA::calculateTerms(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
-    cvector_t k_itilde(k_i.x(), k_i.y(), -k_i.z());
-    Bin1DCVector k_f_bin_tilde =  k_f_bin;
-    k_f_bin_tilde.m_q_lower.setZ( -k_f_bin_tilde.m_q_lower.z() );
-    k_f_bin_tilde.m_q_upper.setZ( -k_f_bin_tilde.m_q_upper.z() );
-    // The four different scattering contributions; S stands for scattering
-    // off the particle, R for reflection off the layer interface
+    // Retrieve the two different incoming wavevectors in the layer
     const ILayerRTCoefficients *p_in_coeff =
             mp_specular_info->getInCoefficients();
-    const ILayerRTCoefficients *p_out_coeff = getOutCoeffs(alpha_f);
+    cvector_t k_i_R = k_i;
+    k_i_R.setZ(p_in_coeff->getScalarKz());
+    cvector_t k_i_T = k_i;
+    k_i_T.setZ(-k_i_R.z());
+    // Retrieve the two different outgoing wavevectors in the layer
+    const ILayerRTCoefficients *p_out_lower = getOutCoeffs(alpha_f_bin.m_lower);
+    const ILayerRTCoefficients *p_out_upper = getOutCoeffs(alpha_f_bin.m_upper);
+    Bin1DCVector k_f_T_bin = k_f_bin;
+    k_f_T_bin.m_q_lower.setZ(p_out_lower->getScalarKz());
+    k_f_T_bin.m_q_upper.setZ(p_out_upper->getScalarKz());
+    Bin1DCVector k_f_R_bin = k_f_bin;
+    k_f_R_bin.m_q_lower.setZ(-k_f_T_bin.m_q_lower.z());
+    k_f_R_bin.m_q_upper.setZ(-k_f_T_bin.m_q_upper.z());
+
 
-    m_term_S = p_in_coeff->getScalarT()*mp_form_factor->evaluate(k_i, k_f_bin,
-            alpha_i, alpha_f)*p_out_coeff->getScalarT();
-    m_term_RS = p_in_coeff->getScalarR()*mp_form_factor->evaluate(k_itilde,
-            k_f_bin, alpha_i, alpha_f)*p_out_coeff->getScalarT();
-    m_term_SR = p_in_coeff->getScalarT()*mp_form_factor->evaluate(k_i,
-            k_f_bin_tilde, alpha_i, alpha_f)*p_out_coeff->getScalarR();
-    m_term_RSR = p_in_coeff->getScalarR()*mp_form_factor->evaluate(k_itilde,
-            k_f_bin_tilde, alpha_i, alpha_f)*p_out_coeff->getScalarR();
+
+    // The four different scattering contributions; S stands for scattering
+    // off the particle, R for reflection off the layer interface
+    double alpha_f = alpha_f_bin.getMidPoint();
+    const ILayerRTCoefficients *p_out_coeff = getOutCoeffs(alpha_f);
+    m_term_S = p_in_coeff->getScalarT()*mp_form_factor->evaluate(k_i_T,
+            k_f_T_bin, alpha_f_bin) * p_out_coeff->getScalarT();
+    m_term_RS = p_in_coeff->getScalarR()*mp_form_factor->evaluate(k_i_R,
+            k_f_T_bin, alpha_f_bin) * p_out_coeff->getScalarT();
+    m_term_SR = p_in_coeff->getScalarT()*mp_form_factor->evaluate(k_i_T,
+            k_f_R_bin, alpha_f_bin) * p_out_coeff->getScalarR();
+    m_term_RSR = p_in_coeff->getScalarR()*mp_form_factor->evaluate(k_i_R,
+            k_f_R_bin, alpha_f_bin) * p_out_coeff->getScalarR();
 }
 
 
diff --git a/Core/FormFactors/src/FormFactorDWBAConstZ.cpp b/Core/FormFactors/src/FormFactorDWBAConstZ.cpp
index 62a7762f7bfbd5744f4c1cbe309a2093b0676e0f..8e5bdc1a871034ef763ac0ca21c4b59004eb05b1 100644
--- a/Core/FormFactors/src/FormFactorDWBAConstZ.cpp
+++ b/Core/FormFactors/src/FormFactorDWBAConstZ.cpp
@@ -24,12 +24,15 @@ FormFactorDWBAConstZ::FormFactorDWBAConstZ(
 }
 
 complex_t FormFactorDWBAConstZ::evaluate(
-    const cvector_t& k_i, const Bin1DCVector& k_f_bin,
-    double alpha_i, double alpha_f) const
+    const cvector_t& k_i, const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
-    calculateTerms(k_i, k_f_bin, alpha_i, alpha_f);
-    complex_t k_iz = k_i.z();
-    complex_t k_fz = k_f_bin.getMidPoint().z();
+    calculateTerms(k_i, k_f_bin, alpha_f_bin);
+    const ILayerRTCoefficients *p_in_coeff =
+            mp_specular_info->getInCoefficients();
+    double alpha_f = alpha_f_bin.getMidPoint();
+    const ILayerRTCoefficients *p_out_coeff = getOutCoeffs(alpha_f);
+    complex_t k_iz = -p_in_coeff->getScalarKz();
+    complex_t k_fz = p_out_coeff->getScalarKz();
     m_term_S *= getDepthPhase(k_iz-k_fz);
     m_term_RS *= getDepthPhase(-k_iz-k_fz);
     m_term_SR *= getDepthPhase(k_iz+k_fz);
diff --git a/Core/FormFactors/src/FormFactorDWBAPol.cpp b/Core/FormFactors/src/FormFactorDWBAPol.cpp
index 45c3adaaa6b8e5dbaaf2ab6decfef11295c9846d..7df7d3969e0f540523d64e2d8632d9f728c30f42 100644
--- a/Core/FormFactors/src/FormFactorDWBAPol.cpp
+++ b/Core/FormFactors/src/FormFactorDWBAPol.cpp
@@ -16,14 +16,16 @@
 #include "FormFactorDWBAPol.h"
 #include "Exceptions.h"
 
-FormFactorDWBAPol::FormFactorDWBAPol(IFormFactor* p_formfactor)
-: FormFactorPol(p_formfactor)
+FormFactorDWBAPol::FormFactorDWBAPol(IFormFactor* p_form_factor)
+: mp_form_factor(p_form_factor)
+, mp_specular_info(0)
 {
     setName("FormFactorDWBAPol");
 }
 
 FormFactorDWBAPol::~FormFactorDWBAPol()
 {
+    delete mp_specular_info;
 }
 
 FormFactorDWBAPol* FormFactorDWBAPol::clone() const
@@ -31,16 +33,23 @@ FormFactorDWBAPol* FormFactorDWBAPol::clone() const
     FormFactorDWBAPol *p_result = new FormFactorDWBAPol(mp_form_factor->clone());
     p_result->setSpecularInfo(*mp_specular_info);
     p_result->setName(getName());
-    p_result->setMaterial(mp_material);
-    p_result->setAmbientMaterial(mp_ambient_material);
     return p_result;
 }
 
+complex_t FormFactorDWBAPol::evaluate(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f) const
+{
+    (void)k_i;
+    (void)k_f_bin;
+    (void)alpha_f;
+    throw NotImplementedException("FormFactorDWBAPol::evaluate: "
+            "should never be called for matrix interactions");
+}
+
 Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const cvector_t& k_i,
-        const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-        double alpha_i, double alpha_f, double phi_f) const
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f, Bin1D phi_f) const
 {
-    calculateTerms(k_i, k_f1_bin, k_f2_bin, alpha_i, alpha_f, phi_f);
+    calculateTerms(k_i, k_f_bin, alpha_f, phi_f);
     Eigen::Matrix2cd result =
             m_M11_S + m_M11_RS + m_M11_SR + m_M11_RSR +
             m_M12_S + m_M12_RS + m_M12_SR + m_M12_RSR +
@@ -49,23 +58,21 @@ Eigen::Matrix2cd FormFactorDWBAPol::evaluatePol(const cvector_t& k_i,
     return result;
 }
 
+void FormFactorDWBAPol::setSpecularInfo(
+        const LayerSpecularInfo& layer_specular_info)
+{
+    delete mp_specular_info;
+    mp_specular_info = layer_specular_info.clone();
+}
+
 void FormFactorDWBAPol::calculateTerms(const cvector_t& k_i,
-        const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-        double alpha_i, double alpha_f, double phi_f) const
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin, Bin1D phi_f_bin) const
 {
     const ILayerRTCoefficients *p_in_coeff =
             mp_specular_info->getInCoefficients();
+    double alpha_f = alpha_f_bin.getMidPoint();
+    double phi_f = phi_f_bin.getMidPoint();
     const ILayerRTCoefficients *p_out_coeff = getOutCoeffs(alpha_f, phi_f);
-    // the conjugated linear part of time reversal operator T
-    // (T=UK with K complex conjugate operator and U is linear)
-    Eigen::Matrix2cd time_reverse_conj = Eigen::Matrix2cd::Zero();
-    time_reverse_conj(0,1) = 1.0;
-    time_reverse_conj(1,0) = -1.0;
-    // the interaction and time reversal taken together:
-    double k_mag2 = std::abs(k_i.magxy2())/std::cos(alpha_i)/std::cos(alpha_i);
-    Eigen::Matrix2cd V_eff = time_reverse_conj *
-            (mp_material->getScatteringMatrix(k_mag2) -
-             mp_ambient_material->getScatteringMatrix(k_mag2));
     // the required wavevectors inside the layer for
     // different eigenmodes and in- and outgoing wavevector;
     complex_t kix = k_i.x();
@@ -74,14 +81,22 @@ void FormFactorDWBAPol::calculateTerms(const cvector_t& k_i,
     cvector_t ki_1T(kix, kiy, -p_in_coeff->getKz()(0));
     cvector_t ki_2R(kix, kiy, p_in_coeff->getKz()(1));
     cvector_t ki_2T(kix, kiy, -p_in_coeff->getKz()(1));
-    Bin1DCVector kf_1R = k_f1_bin;
-    kf_1R.m_q_lower.setZ(-kf_1R.m_q_lower.z());
-    kf_1R.m_q_upper.setZ(-kf_1R.m_q_upper.z());
-    Bin1DCVector kf_1T = k_f1_bin;
-    Bin1DCVector kf_2R = k_f2_bin;
-    kf_2R.m_q_lower.setZ(-kf_2R.m_q_lower.z());
-    kf_2R.m_q_upper.setZ(-kf_2R.m_q_upper.z());
-    Bin1DCVector kf_2T = k_f2_bin;
+    const ILayerRTCoefficients *p_out_lower = getOutCoeffs(alpha_f_bin.m_lower,
+            phi_f_bin.m_lower);
+    const ILayerRTCoefficients *p_out_upper = getOutCoeffs(alpha_f_bin.m_upper,
+            phi_f_bin.m_upper);
+    Bin1DCVector kf_1R = k_f_bin;
+    kf_1R.m_q_lower.setZ(-(complex_t)p_out_lower->getKz()(0));
+    kf_1R.m_q_upper.setZ(-(complex_t)p_out_upper->getKz()(0));
+    Bin1DCVector kf_1T = k_f_bin;
+    kf_1T.m_q_lower.setZ((complex_t)p_out_lower->getKz()(0));
+    kf_1T.m_q_upper.setZ((complex_t)p_out_upper->getKz()(0));
+    Bin1DCVector kf_2R = k_f_bin;
+    kf_2R.m_q_lower.setZ(-(complex_t)p_out_lower->getKz()(1));
+    kf_2R.m_q_upper.setZ(-(complex_t)p_out_upper->getKz()(1));
+    Bin1DCVector kf_2T = k_f_bin;
+    kf_2T.m_q_lower.setZ((complex_t)p_out_lower->getKz()(1));
+    kf_2T.m_q_upper.setZ((complex_t)p_out_upper->getKz()(1));
     // now each of the 16 matrix terms of the polarized DWBA is calculated:
     // NOTE: when the underlying reflection/transmission coefficients are
     // scalar, the eigenmodes have identical eigenvalues and spin polarization
@@ -91,104 +106,105 @@ void FormFactorDWBAPol::calculateTerms(const cvector_t& k_i,
     //     real m_M21 = calculated m_M22
     //     real m_M22 = calculated m_M21
     // Since both eigenvalues are identical, this does not influence the result.
-    // eigenmode 1 -> eigenmode 1: direct scattering
-    m_M11_S(0,0) = - p_out_coeff->T1min().transpose() * V_eff * p_in_coeff->T1plus();
-    m_M11_S(0,1) =  p_out_coeff->T1plus().transpose() * V_eff * p_in_coeff->T1plus();
-    m_M11_S(1,0) = - p_out_coeff->T1min().transpose() * V_eff * p_in_coeff->T1min();
-    m_M11_S(1,1) =  p_out_coeff->T1plus().transpose() * V_eff * p_in_coeff->T1min();
+    Eigen::Matrix2cd ff_BA;
 
-    m_M11_S *= mp_form_factor->evaluate(ki_1T, kf_1T, alpha_i, alpha_f);
+    // eigenmode 1 -> eigenmode 1: direct scattering
+    ff_BA = mp_form_factor->evaluatePol(ki_1T, kf_1T, alpha_f_bin, phi_f_bin);
+    m_M11_S(0,0) = - p_out_coeff->T1min().transpose() * ff_BA * p_in_coeff->T1plus();
+    m_M11_S(0,1) =  p_out_coeff->T1plus().transpose() * ff_BA * p_in_coeff->T1plus();
+    m_M11_S(1,0) = - p_out_coeff->T1min().transpose() * ff_BA * p_in_coeff->T1min();
+    m_M11_S(1,1) =  p_out_coeff->T1plus().transpose() * ff_BA * p_in_coeff->T1min();
     // eigenmode 1 -> eigenmode 1: reflection and then scattering
-    m_M11_RS(0,0) = - p_out_coeff->T1min().transpose() * V_eff * p_in_coeff->R1plus();
-    m_M11_RS(0,1) =  p_out_coeff->T1plus().transpose() * V_eff * p_in_coeff->R1plus();
-    m_M11_RS(1,0) = - p_out_coeff->T1min().transpose() * V_eff * p_in_coeff->R1min();
-    m_M11_RS(1,1) =  p_out_coeff->T1plus().transpose() * V_eff * p_in_coeff->R1min();
-    m_M11_RS *= mp_form_factor->evaluate(ki_1R, kf_1T, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_1R, kf_1T, alpha_f_bin, phi_f_bin);
+    m_M11_RS(0,0) = - p_out_coeff->T1min().transpose() * ff_BA * p_in_coeff->R1plus();
+    m_M11_RS(0,1) =  p_out_coeff->T1plus().transpose() * ff_BA * p_in_coeff->R1plus();
+    m_M11_RS(1,0) = - p_out_coeff->T1min().transpose() * ff_BA * p_in_coeff->R1min();
+    m_M11_RS(1,1) =  p_out_coeff->T1plus().transpose() * ff_BA * p_in_coeff->R1min();
     // eigenmode 1 -> eigenmode 1: scattering and then reflection
-    m_M11_SR(0,0) = - p_out_coeff->R1min().transpose() * V_eff * p_in_coeff->T1plus();
-    m_M11_SR(0,1) =  p_out_coeff->R1plus().transpose() * V_eff * p_in_coeff->T1plus();
-    m_M11_SR(1,0) = - p_out_coeff->R1min().transpose() * V_eff * p_in_coeff->T1min();
-    m_M11_SR(1,1) =  p_out_coeff->R1plus().transpose() * V_eff * p_in_coeff->T1min();
-    m_M11_SR *= mp_form_factor->evaluate(ki_1T, kf_1R, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_1T, kf_1R, alpha_f_bin, phi_f_bin);
+    m_M11_SR(0,0) = - p_out_coeff->R1min().transpose() * ff_BA * p_in_coeff->T1plus();
+    m_M11_SR(0,1) =  p_out_coeff->R1plus().transpose() * ff_BA * p_in_coeff->T1plus();
+    m_M11_SR(1,0) = - p_out_coeff->R1min().transpose() * ff_BA * p_in_coeff->T1min();
+    m_M11_SR(1,1) =  p_out_coeff->R1plus().transpose() * ff_BA * p_in_coeff->T1min();
     // eigenmode 1 -> eigenmode 1: reflection, scattering and again reflection
-    m_M11_RSR(0,0) = - p_out_coeff->R1min().transpose() * V_eff * p_in_coeff->R1plus();
-    m_M11_RSR(0,1) =  p_out_coeff->R1plus().transpose() * V_eff * p_in_coeff->R1plus();
-    m_M11_RSR(1,0) = - p_out_coeff->R1min().transpose() * V_eff * p_in_coeff->R1min();
-    m_M11_RSR(1,1) =  p_out_coeff->R1plus().transpose() * V_eff * p_in_coeff->R1min();
-    m_M11_RSR *= mp_form_factor->evaluate(ki_1R, kf_1R, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_1R, kf_1R, alpha_f_bin, phi_f_bin);
+    m_M11_RSR(0,0) = - p_out_coeff->R1min().transpose() * ff_BA * p_in_coeff->R1plus();
+    m_M11_RSR(0,1) =  p_out_coeff->R1plus().transpose() * ff_BA * p_in_coeff->R1plus();
+    m_M11_RSR(1,0) = - p_out_coeff->R1min().transpose() * ff_BA * p_in_coeff->R1min();
+    m_M11_RSR(1,1) =  p_out_coeff->R1plus().transpose() * ff_BA * p_in_coeff->R1min();
 
     // eigenmode 1 -> eigenmode 2: direct scattering
-    m_M12_S(0,0) = - p_out_coeff->T2min().transpose() * V_eff * p_in_coeff->T1plus();
-    m_M12_S(0,1) =  p_out_coeff->T2plus().transpose() * V_eff * p_in_coeff->T1plus();
-    m_M12_S(1,0) = - p_out_coeff->T2min().transpose() * V_eff * p_in_coeff->T1min();
-    m_M12_S(1,1) =  p_out_coeff->T2plus().transpose() * V_eff * p_in_coeff->T1min();
-    m_M12_S *= mp_form_factor->evaluate(ki_1T, kf_2T, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_1T, kf_2T, alpha_f_bin, phi_f_bin);
+    m_M12_S(0,0) = - p_out_coeff->T2min().transpose() * ff_BA * p_in_coeff->T1plus();
+    m_M12_S(0,1) =  p_out_coeff->T2plus().transpose() * ff_BA * p_in_coeff->T1plus();
+    m_M12_S(1,0) = - p_out_coeff->T2min().transpose() * ff_BA * p_in_coeff->T1min();
+    m_M12_S(1,1) =  p_out_coeff->T2plus().transpose() * ff_BA * p_in_coeff->T1min();
     // eigenmode 1 -> eigenmode 2: reflection and then scattering
-    m_M12_RS(0,0) = - p_out_coeff->T2min().transpose() * V_eff * p_in_coeff->R1plus();
-    m_M12_RS(0,1) =  p_out_coeff->T2plus().transpose() * V_eff * p_in_coeff->R1plus();
-    m_M12_RS(1,0) = - p_out_coeff->T2min().transpose() * V_eff * p_in_coeff->R1min();
-    m_M12_RS(1,1) =  p_out_coeff->T2plus().transpose() * V_eff * p_in_coeff->R1min();
-    m_M12_RS *= mp_form_factor->evaluate(ki_1R, kf_2T, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_1R, kf_2T, alpha_f_bin, phi_f_bin);
+    m_M12_RS(0,0) = - p_out_coeff->T2min().transpose() * ff_BA * p_in_coeff->R1plus();
+    m_M12_RS(0,1) =  p_out_coeff->T2plus().transpose() * ff_BA * p_in_coeff->R1plus();
+    m_M12_RS(1,0) = - p_out_coeff->T2min().transpose() * ff_BA * p_in_coeff->R1min();
+    m_M12_RS(1,1) =  p_out_coeff->T2plus().transpose() * ff_BA * p_in_coeff->R1min();
     // eigenmode 1 -> eigenmode 2: scattering and then reflection
-    m_M12_SR(0,0) = - p_out_coeff->R2min().transpose() * V_eff * p_in_coeff->T1plus();
-    m_M12_SR(0,1) =  p_out_coeff->R2plus().transpose() * V_eff * p_in_coeff->T1plus();
-    m_M12_SR(1,0) = - p_out_coeff->R2min().transpose() * V_eff * p_in_coeff->T1min();
-    m_M12_SR(1,1) =  p_out_coeff->R2plus().transpose() * V_eff * p_in_coeff->T1min();
-    m_M12_SR *= mp_form_factor->evaluate(ki_1T, kf_2R, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_1T, kf_2R, alpha_f_bin, phi_f_bin);
+    m_M12_SR(0,0) = - p_out_coeff->R2min().transpose() * ff_BA * p_in_coeff->T1plus();
+    m_M12_SR(0,1) =  p_out_coeff->R2plus().transpose() * ff_BA * p_in_coeff->T1plus();
+    m_M12_SR(1,0) = - p_out_coeff->R2min().transpose() * ff_BA * p_in_coeff->T1min();
+    m_M12_SR(1,1) =  p_out_coeff->R2plus().transpose() * ff_BA * p_in_coeff->T1min();
     // eigenmode 1 -> eigenmode 2: reflection, scattering and again reflection
-    m_M12_RSR(0,0) = - p_out_coeff->R2min().transpose() * V_eff * p_in_coeff->R1plus();
-    m_M12_RSR(0,1) =  p_out_coeff->R2plus().transpose() * V_eff * p_in_coeff->R1plus();
-    m_M12_RSR(1,0) = - p_out_coeff->R2min().transpose() * V_eff * p_in_coeff->R1min();
-    m_M12_RSR(1,1) =  p_out_coeff->R2plus().transpose() * V_eff * p_in_coeff->R1min();
-    m_M12_RSR *= mp_form_factor->evaluate(ki_1R, kf_2R, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_1R, kf_2R, alpha_f_bin, phi_f_bin);
+    m_M12_RSR(0,0) = - p_out_coeff->R2min().transpose() * ff_BA * p_in_coeff->R1plus();
+    m_M12_RSR(0,1) =  p_out_coeff->R2plus().transpose() * ff_BA * p_in_coeff->R1plus();
+    m_M12_RSR(1,0) = - p_out_coeff->R2min().transpose() * ff_BA * p_in_coeff->R1min();
+    m_M12_RSR(1,1) =  p_out_coeff->R2plus().transpose() * ff_BA * p_in_coeff->R1min();
 
     // eigenmode 2 -> eigenmode 1: direct scattering
-    m_M21_S(0,0) = - p_out_coeff->T1min().transpose() * V_eff * p_in_coeff->T2plus();
-    m_M21_S(0,1) =  p_out_coeff->T1plus().transpose() * V_eff * p_in_coeff->T2plus();
-    m_M21_S(1,0) = - p_out_coeff->T1min().transpose() * V_eff * p_in_coeff->T2min();
-    m_M21_S(1,1) =  p_out_coeff->T1plus().transpose() * V_eff * p_in_coeff->T2min();
-    m_M21_S *= mp_form_factor->evaluate(ki_2T, kf_1T, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_2T, kf_1T, alpha_f_bin, phi_f_bin);
+    m_M21_S(0,0) = - p_out_coeff->T1min().transpose() * ff_BA * p_in_coeff->T2plus();
+    m_M21_S(0,1) =  p_out_coeff->T1plus().transpose() * ff_BA * p_in_coeff->T2plus();
+    m_M21_S(1,0) = - p_out_coeff->T1min().transpose() * ff_BA * p_in_coeff->T2min();
+    m_M21_S(1,1) =  p_out_coeff->T1plus().transpose() * ff_BA * p_in_coeff->T2min();
     // eigenmode 2 -> eigenmode 1: reflection and then scattering
-    m_M21_RS(0,0) = - p_out_coeff->T1min().transpose() * V_eff * p_in_coeff->R2plus();
-    m_M21_RS(0,1) =  p_out_coeff->T1plus().transpose() * V_eff * p_in_coeff->R2plus();
-    m_M21_RS(1,0) = - p_out_coeff->T1min().transpose() * V_eff * p_in_coeff->R2min();
-    m_M21_RS(1,1) =  p_out_coeff->T1plus().transpose() * V_eff * p_in_coeff->R2min();
-    m_M21_RS *= mp_form_factor->evaluate(ki_2R, kf_1T, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_2R, kf_1T, alpha_f_bin, phi_f_bin);
+    m_M21_RS(0,0) = - p_out_coeff->T1min().transpose() * ff_BA * p_in_coeff->R2plus();
+    m_M21_RS(0,1) =  p_out_coeff->T1plus().transpose() * ff_BA * p_in_coeff->R2plus();
+    m_M21_RS(1,0) = - p_out_coeff->T1min().transpose() * ff_BA * p_in_coeff->R2min();
+    m_M21_RS(1,1) =  p_out_coeff->T1plus().transpose() * ff_BA * p_in_coeff->R2min();
     // eigenmode 2 -> eigenmode 1: scattering and then reflection
-    m_M21_SR(0,0) = - p_out_coeff->R1min().transpose() * V_eff * p_in_coeff->T2plus();
-    m_M21_SR(0,1) =  p_out_coeff->R1plus().transpose() * V_eff * p_in_coeff->T2plus();
-    m_M21_SR(1,0) = - p_out_coeff->R1min().transpose() * V_eff * p_in_coeff->T2min();
-    m_M21_SR(1,1) =  p_out_coeff->R1plus().transpose() * V_eff * p_in_coeff->T2min();
-    m_M21_SR *= mp_form_factor->evaluate(ki_2T, kf_1R, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_2T, kf_1R, alpha_f_bin, phi_f_bin);
+    m_M21_SR(0,0) = - p_out_coeff->R1min().transpose() * ff_BA * p_in_coeff->T2plus();
+    m_M21_SR(0,1) =  p_out_coeff->R1plus().transpose() * ff_BA * p_in_coeff->T2plus();
+    m_M21_SR(1,0) = - p_out_coeff->R1min().transpose() * ff_BA * p_in_coeff->T2min();
+    m_M21_SR(1,1) =  p_out_coeff->R1plus().transpose() * ff_BA * p_in_coeff->T2min();
     // eigenmode 2 -> eigenmode 1: reflection, scattering and again reflection
-    m_M21_RSR(0,0) = - p_out_coeff->R1min().transpose() * V_eff * p_in_coeff->R2plus();
-    m_M21_RSR(0,1) =  p_out_coeff->R1plus().transpose() * V_eff * p_in_coeff->R2plus();
-    m_M21_RSR(1,0) = - p_out_coeff->R1min().transpose() * V_eff * p_in_coeff->R2min();
-    m_M21_RSR(1,1) =  p_out_coeff->R1plus().transpose() * V_eff * p_in_coeff->R2min();
-    m_M21_RSR *= mp_form_factor->evaluate(ki_2R, kf_1R, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_2R, kf_1R, alpha_f_bin, phi_f_bin);
+    m_M21_RSR(0,0) = - p_out_coeff->R1min().transpose() * ff_BA * p_in_coeff->R2plus();
+    m_M21_RSR(0,1) =  p_out_coeff->R1plus().transpose() * ff_BA * p_in_coeff->R2plus();
+    m_M21_RSR(1,0) = - p_out_coeff->R1min().transpose() * ff_BA * p_in_coeff->R2min();
+    m_M21_RSR(1,1) =  p_out_coeff->R1plus().transpose() * ff_BA * p_in_coeff->R2min();
 
     // eigenmode 2 -> eigenmode 2: direct scattering
-    m_M22_S(0,0) = - p_out_coeff->T2min().transpose() * V_eff * p_in_coeff->T2plus();
-    m_M22_S(0,1) =  p_out_coeff->T2plus().transpose() * V_eff * p_in_coeff->T2plus();
-    m_M22_S(1,0) = - p_out_coeff->T2min().transpose() * V_eff * p_in_coeff->T2min();
-    m_M22_S(1,1) =  p_out_coeff->T2plus().transpose() * V_eff * p_in_coeff->T2min();
-    m_M22_S *= mp_form_factor->evaluate(ki_2T, kf_2T, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_2T, kf_2T, alpha_f_bin, phi_f_bin);
+    m_M22_S(0,0) = - p_out_coeff->T2min().transpose() * ff_BA * p_in_coeff->T2plus();
+    m_M22_S(0,1) =  p_out_coeff->T2plus().transpose() * ff_BA * p_in_coeff->T2plus();
+    m_M22_S(1,0) = - p_out_coeff->T2min().transpose() * ff_BA * p_in_coeff->T2min();
+    m_M22_S(1,1) =  p_out_coeff->T2plus().transpose() * ff_BA * p_in_coeff->T2min();
     // eigenmode 2 -> eigenmode 2: reflection and then scattering
-    m_M22_RS(0,0) = - p_out_coeff->T2min().transpose() * V_eff * p_in_coeff->R2plus();
-    m_M22_RS(0,1) =  p_out_coeff->T2plus().transpose() * V_eff * p_in_coeff->R2plus();
-    m_M22_RS(1,0) = - p_out_coeff->T2min().transpose() * V_eff * p_in_coeff->R2min();
-    m_M22_RS(1,1) =  p_out_coeff->T2plus().transpose() * V_eff * p_in_coeff->R2min();
-    m_M22_RS *= mp_form_factor->evaluate(ki_2R, kf_2T, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_2R, kf_2T, alpha_f_bin, phi_f_bin);
+    m_M22_RS(0,0) = - p_out_coeff->T2min().transpose() * ff_BA * p_in_coeff->R2plus();
+    m_M22_RS(0,1) =  p_out_coeff->T2plus().transpose() * ff_BA * p_in_coeff->R2plus();
+    m_M22_RS(1,0) = - p_out_coeff->T2min().transpose() * ff_BA * p_in_coeff->R2min();
+    m_M22_RS(1,1) =  p_out_coeff->T2plus().transpose() * ff_BA * p_in_coeff->R2min();
     // eigenmode 2 -> eigenmode 2: scattering and then reflection
-    m_M22_SR(0,0) = - p_out_coeff->R2min().transpose() * V_eff * p_in_coeff->T2plus();
-    m_M22_SR(0,1) =  p_out_coeff->R2plus().transpose() * V_eff * p_in_coeff->T2plus();
-    m_M22_SR(1,0) = - p_out_coeff->R2min().transpose() * V_eff * p_in_coeff->T2min();
-    m_M22_SR(1,1) =  p_out_coeff->R2plus().transpose() * V_eff * p_in_coeff->T2min();
-    m_M22_SR *= mp_form_factor->evaluate(ki_2T, kf_2R, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_2T, kf_2R, alpha_f_bin, phi_f_bin);
+    m_M22_SR(0,0) = - p_out_coeff->R2min().transpose() * ff_BA * p_in_coeff->T2plus();
+    m_M22_SR(0,1) =  p_out_coeff->R2plus().transpose() * ff_BA * p_in_coeff->T2plus();
+    m_M22_SR(1,0) = - p_out_coeff->R2min().transpose() * ff_BA * p_in_coeff->T2min();
+    m_M22_SR(1,1) =  p_out_coeff->R2plus().transpose() * ff_BA * p_in_coeff->T2min();
     // eigenmode 2 -> eigenmode 2: reflection, scattering and again reflection
-    m_M22_RSR(0,0) = - p_out_coeff->R2min().transpose() * V_eff * p_in_coeff->R2plus();
-    m_M22_RSR(0,1) =  p_out_coeff->R2plus().transpose() * V_eff * p_in_coeff->R2plus();
-    m_M22_RSR(1,0) = - p_out_coeff->R2min().transpose() * V_eff * p_in_coeff->R2min();
-    m_M22_RSR(1,1) =  p_out_coeff->R2plus().transpose() * V_eff * p_in_coeff->R2min();
-    m_M22_RSR *= mp_form_factor->evaluate(ki_2R, kf_2R, alpha_i, alpha_f);
+    ff_BA = mp_form_factor->evaluatePol(ki_2R, kf_2R, alpha_f_bin, phi_f_bin);
+    m_M22_RSR(0,0) = - p_out_coeff->R2min().transpose() * ff_BA * p_in_coeff->R2plus();
+    m_M22_RSR(0,1) =  p_out_coeff->R2plus().transpose() * ff_BA * p_in_coeff->R2plus();
+    m_M22_RSR(1,0) = - p_out_coeff->R2min().transpose() * ff_BA * p_in_coeff->R2min();
+    m_M22_RSR(1,1) =  p_out_coeff->R2plus().transpose() * ff_BA * p_in_coeff->R2min();
 }
diff --git a/Core/FormFactors/src/FormFactorDWBAPolConstZ.cpp b/Core/FormFactors/src/FormFactorDWBAPolConstZ.cpp
index 0806c35d30a179b9ac16159b5e63e65baf4c93a0..66c817fbf1f4d1177350005692a22885312e3757 100644
--- a/Core/FormFactors/src/FormFactorDWBAPolConstZ.cpp
+++ b/Core/FormFactors/src/FormFactorDWBAPolConstZ.cpp
@@ -37,21 +37,24 @@ FormFactorDWBAPolConstZ* FormFactorDWBAPolConstZ::clone() const
 }
 
 Eigen::Matrix2cd FormFactorDWBAPolConstZ::evaluatePol(const cvector_t& k_i,
-        const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-        double alpha_i, double alpha_f, double phi_f) const
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin, Bin1D phi_f_bin) const
 {
     // get all different z-components of wavevectors
     const ILayerRTCoefficients *in_coeff =
             mp_specular_info->getInCoefficients();
+    double alpha_f = alpha_f_bin.getMidPoint();
+    double phi_f = phi_f_bin.getMidPoint();
+    const ILayerRTCoefficients *p_out_coeffs =
+            mp_specular_info->getOutCoefficients(alpha_f, phi_f);
     complex_t kiz_1R = in_coeff->getKz()(0);
     complex_t kiz_1T = -in_coeff->getKz()(0);
     complex_t kiz_2R = in_coeff->getKz()(1);
     complex_t kiz_2T = -in_coeff->getKz()(1);
-    complex_t kfz_1R = k_f1_bin.getMidPoint().z();
+    complex_t kfz_1R = p_out_coeffs->getKz()(0);
     complex_t kfz_1T = -kfz_1R;
-    complex_t kfz_2R = k_f2_bin.getMidPoint().z();
+    complex_t kfz_2R = p_out_coeffs->getKz()(1);;
     complex_t kfz_2T = -kfz_2R;
-    calculateTerms(k_i, k_f1_bin, k_f2_bin, alpha_i, alpha_f, phi_f);
+    calculateTerms(k_i, k_f_bin, alpha_f_bin, phi_f_bin);
 
     // multiply with correct phases from depth of particle
     // eigenmode 1 -> eigenmode 1
diff --git a/Core/FormFactors/src/FormFactorDecoratorDebyeWaller.cpp b/Core/FormFactors/src/FormFactorDecoratorDebyeWaller.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..3481d48c257f6d4d1158758a04fabab0fd7f7d32
--- /dev/null
+++ b/Core/FormFactors/src/FormFactorDecoratorDebyeWaller.cpp
@@ -0,0 +1,73 @@
+// ************************************************************************** //
+//
+//  BornAgain: simulate and fit scattering at grazing incidence
+//
+//! @file      FormFactors/src/FormFactorDecoratorDebyeWaller.cpp
+//! @brief     Defines class FormFactorDecoratorDebyeWaller.
+//!
+//! @homepage  http://apps.jcns.fz-juelich.de/BornAgain
+//! @license   GNU General Public License v3 or higher (see COPYING)
+//! @copyright Forschungszentrum Jülich GmbH 2013
+//! @authors   Scientific Computing Group at MLZ Garching
+//! @authors   C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
+//
+// ************************************************************************** //
+
+#include "FormFactorDecoratorDebyeWaller.h"
+
+FormFactorDecoratorDebyeWaller::FormFactorDecoratorDebyeWaller(
+        IFormFactor* p_form_factor, double dw_factor)
+: IFormFactorDecorator(p_form_factor)
+, m_h_dw_factor(dw_factor)
+, m_r_dw_factor(dw_factor)
+{
+    setName("FormFactorDecoratorDebyeWaller");
+    init_parameters();
+}
+
+FormFactorDecoratorDebyeWaller::FormFactorDecoratorDebyeWaller(
+        IFormFactor* p_form_factor, double dw_h_factor, double dw_r_factor)
+: IFormFactorDecorator(p_form_factor)
+, m_h_dw_factor(dw_h_factor)
+, m_r_dw_factor(dw_r_factor)
+{
+    setName("FormFactorDecoratorDebyeWaller");
+    init_parameters();
+}
+
+FormFactorDecoratorDebyeWaller::FormFactorDecoratorDebyeWaller(
+        const IFormFactor& p_form_factor, double dw_h_factor,
+        double dw_r_factor)
+: IFormFactorDecorator(p_form_factor.clone())
+, m_h_dw_factor(dw_h_factor)
+, m_r_dw_factor(dw_r_factor)
+{
+    setName("FormFactorDecoratorDebyeWaller");
+    init_parameters();
+}
+
+FormFactorDecoratorDebyeWaller* FormFactorDecoratorDebyeWaller::clone() const
+{
+    FormFactorDecoratorDebyeWaller *result =
+            new FormFactorDecoratorDebyeWaller(
+        mp_form_factor->clone(), m_h_dw_factor, m_r_dw_factor);
+    result->setName(getName());
+    return result;
+}
+
+complex_t FormFactorDecoratorDebyeWaller::evaluate(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
+{
+    cvector_t q = k_i - k_f_bin.getMidPoint();
+    double qr2 = std::norm(q.x()) + std::norm(q.y());
+    double qz2 = std::norm(q.z());
+    double dw = std::exp(-qz2*m_h_dw_factor-qr2*m_r_dw_factor);
+    return dw*mp_form_factor->evaluate(k_i, k_f_bin, alpha_f_bin);
+}
+
+void FormFactorDecoratorDebyeWaller::init_parameters()
+{
+    clearParameterPool();
+    registerParameter("hfactor", &m_h_dw_factor);
+    registerParameter("rfactor", &m_r_dw_factor);
+}
diff --git a/Core/FormFactors/src/FormFactorDecoratorMaterial.cpp b/Core/FormFactors/src/FormFactorDecoratorMaterial.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..90aed4541646dc31fc8aadeb3f844d58a3a56ce4
--- /dev/null
+++ b/Core/FormFactors/src/FormFactorDecoratorMaterial.cpp
@@ -0,0 +1,97 @@
+// ************************************************************************** //
+//
+//  BornAgain: simulate and fit scattering at grazing incidence
+//
+//! @file      FormFactorDecoratorMaterial.cpp
+//! @brief     Defines class .
+//!
+//! @homepage  http://apps.jcns.fz-juelich.de/BornAgain
+//! @license   GNU General Public License v3 or higher (see COPYING)
+//! @copyright Forschungszentrum Jülich GmbH 2013
+//! @authors   Scientific Computing Group at MLZ Garching
+//! @authors   C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
+//
+// ************************************************************************** //
+
+#include "FormFactorDecoratorMaterial.h"
+
+FormFactorDecoratorMaterial::FormFactorDecoratorMaterial(
+        IFormFactor* p_form_factor, complex_t wavevector_scattering_factor)
+: FormFactorDecoratorFactor(p_form_factor, 1.0)
+, m_wavevector_scattering_factor(wavevector_scattering_factor)
+, mp_material(0)
+, mp_ambient_material(0)
+{
+    setName("FormFactorDecoratorMaterial");
+}
+
+FormFactorDecoratorMaterial::~FormFactorDecoratorMaterial()
+{
+}
+
+FormFactorDecoratorMaterial *FormFactorDecoratorMaterial::clone() const
+{
+    FormFactorDecoratorMaterial *result =
+            new FormFactorDecoratorMaterial(mp_form_factor->clone(),
+                    m_wavevector_scattering_factor);
+    result->setMaterial(mp_material);
+    result->setAmbientMaterial(mp_ambient_material);
+    result->setName(getName());
+    return result;
+}
+
+void FormFactorDecoratorMaterial::setMaterial(const IMaterial* p_material)
+{
+    if (p_material) {
+        mp_material = p_material;
+    }
+    m_factor = getRefractiveIndexFactor();
+}
+
+complex_t FormFactorDecoratorMaterial::getAmbientRefractiveIndex() const
+{
+    if (mp_ambient_material) {
+        return mp_ambient_material->getRefractiveIndex();
+    }
+    return 1.0;
+}
+
+Eigen::Matrix2cd FormFactorDecoratorMaterial::evaluatePol(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin, Bin1D phi_f_bin) const
+{
+    (void)phi_f_bin;
+    // the conjugated linear part of time reversal operator T
+    // (T=UK with K complex conjugate operator and U is linear)
+    Eigen::Matrix2cd time_reverse_conj = Eigen::Matrix2cd::Zero();
+    time_reverse_conj(0,1) = 1.0;
+    time_reverse_conj(1,0) = -1.0;
+    // the interaction and time reversal taken together:
+    double alpha_f = alpha_f_bin.getMidPoint();
+    double k_mag2 = k_f_bin.getMidPoint().magxy2().real()
+                  / std::cos(alpha_f) / std::cos(alpha_f);
+    Eigen::Matrix2cd V_eff = m_wavevector_scattering_factor * time_reverse_conj
+            * (mp_material->getScatteringMatrix(k_mag2) -
+               mp_ambient_material->getScatteringMatrix(k_mag2));
+    return mp_form_factor->evaluate(k_i, k_f_bin, alpha_f_bin) * V_eff;
+}
+
+void FormFactorDecoratorMaterial::setAmbientMaterial(
+        const IMaterial *p_material)
+{
+    if (p_material) {
+        mp_ambient_material = p_material;
+    }
+    m_factor = getRefractiveIndexFactor();
+}
+
+complex_t FormFactorDecoratorMaterial::getRefractiveIndexFactor() const
+{
+    if (mp_material && mp_ambient_material) {
+        complex_t particle_index = mp_material->getRefractiveIndex();
+        complex_t ambient_index = mp_ambient_material->getRefractiveIndex();
+        return m_wavevector_scattering_factor *
+                (particle_index*particle_index - ambient_index*ambient_index);
+    }
+    else return m_wavevector_scattering_factor;
+}
+
diff --git a/Core/FormFactors/src/FormFactorDecoratorMultiPositionFactor.cpp b/Core/FormFactors/src/FormFactorDecoratorMultiPositionFactor.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b8f76861dc9546eb689789f2fc9a647e8adfc4c0
--- /dev/null
+++ b/Core/FormFactors/src/FormFactorDecoratorMultiPositionFactor.cpp
@@ -0,0 +1,61 @@
+// ************************************************************************** //
+//
+//  BornAgain: simulate and fit scattering at grazing incidence
+//
+//! @file      FormFactors/src/FormFactorDecoratorMultiPositionFactor.cpp
+//! @brief     Implements class FormFactorDecoratorMultiPositionFactor.
+//!
+//! @homepage  http://apps.jcns.fz-juelich.de/BornAgain
+//! @license   GNU General Public License v3 or higher (see COPYING)
+//! @copyright Forschungszentrum Jülich GmbH 2013
+//! @authors   Scientific Computing Group at MLZ Garching
+//! @authors   C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
+//
+// ************************************************************************** //
+
+#include "FormFactorDecoratorMultiPositionFactor.h"
+
+FormFactorDecoratorMultiPositionFactor::FormFactorDecoratorMultiPositionFactor(
+        const IFormFactor& form_factor, std::vector<kvector_t> positions)
+: IFormFactorDecorator(form_factor.clone())
+, m_positions(positions)
+{
+    setName("FormFactorDecoratorMultiPositionFactor");
+}
+
+FormFactorDecoratorMultiPositionFactor*
+FormFactorDecoratorMultiPositionFactor::clone() const
+{
+    return new FormFactorDecoratorMultiPositionFactor(
+            *mp_form_factor, m_positions);
+}
+
+complex_t FormFactorDecoratorMultiPositionFactor::evaluate(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
+{
+    cvector_t q = k_i - k_f_bin.getMidPoint();
+    return getPositionsFactor(q)*mp_form_factor->
+               evaluate(k_i, k_f_bin, alpha_f_bin);
+}
+
+Eigen::Matrix2cd FormFactorDecoratorMultiPositionFactor::evaluatePol(
+        const cvector_t& k_i, const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin,
+        Bin1D phi_f_bin) const
+{
+    cvector_t q = k_i - k_f_bin.getMidPoint();
+    return getPositionsFactor(q)*mp_form_factor->
+               evaluatePol(k_i, k_f_bin, alpha_f_bin, phi_f_bin);
+}
+
+complex_t FormFactorDecoratorMultiPositionFactor::getPositionsFactor(
+        cvector_t q) const
+{
+    complex_t result;
+    for (size_t i=0; i<m_positions.size(); ++i) {
+        complex_t qr = q.x()*m_positions[i].x() + q.y()*m_positions[i].y()
+                + q.z()*m_positions[i].z();
+        result += std::exp(complex_t(0.0, 1.0)*qr);
+    }
+    return result;
+}
+
diff --git a/Core/FormFactors/src/FormFactorPol.cpp b/Core/FormFactors/src/FormFactorPol.cpp
deleted file mode 100644
index e85968ebe024e58f1db1d637f158083c6849eb99..0000000000000000000000000000000000000000
--- a/Core/FormFactors/src/FormFactorPol.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// ************************************************************************** //
-//
-//  BornAgain: simulate and fit scattering at grazing incidence
-//
-//! @file      FormFactors/src/FormFactorPol.cpp
-//! @brief     Implements class FormFactorPol.
-//!
-//! @homepage  http://apps.jcns.fz-juelich.de/BornAgain
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2013
-//! @authors   Scientific Computing Group at MLZ Garching
-//! @authors   C. Durniak, G. Pospelov, W. Van Herck, J. Wuttke
-//
-// ************************************************************************** //
-
-#include "FormFactorPol.h"
-
-FormFactorPol* FormFactorPol::clone() const
-{
-    FormFactorPol *p_result = new FormFactorPol(mp_form_factor->clone());
-    p_result->setSpecularInfo(*mp_specular_info);
-    p_result->setName(getName());
-    p_result->setMaterial(mp_material);
-    p_result->setAmbientMaterial(mp_ambient_material);
-    return p_result;
-}
-
-FormFactorPol::~FormFactorPol()
-{
-    delete mp_specular_info;
-}
-
-complex_t FormFactorPol::evaluate(const cvector_t& k_i,
-        const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
-{
-    (void)k_i;
-    (void)k_f_bin;
-    (void)alpha_i;
-    (void)alpha_f;
-    throw Exceptions::NotImplementedException("FormFactorPol::evaluate:"
-            " scalar evaluate should never be called for matrix ff");
-}
-
-Eigen::Matrix2cd FormFactorPol::evaluatePol(const cvector_t& k_i,
-        const Bin1DCVector& k_f1_bin, const Bin1DCVector& k_f2_bin,
-        double alpha_i, double alpha_f, double phi_f) const
-{
-    (void)k_f2_bin;
-    (void)phi_f;
-    // the conjugated linear part of time reversal operator T
-    // (T=UK with K complex conjugate operator and U is linear)
-    Eigen::Matrix2cd time_reverse_conj = Eigen::Matrix2cd::Zero();
-    time_reverse_conj(0,1) = 1.0;
-    time_reverse_conj(1,0) = -1.0;
-    // the interaction and time reversal taken together:
-    double k_mag2 = std::abs(k_i.magxy2())/std::cos(alpha_i)/std::cos(alpha_i);
-    Eigen::Matrix2cd V_eff = time_reverse_conj *
-            (mp_material->getScatteringMatrix(k_mag2) -
-             mp_ambient_material->getScatteringMatrix(k_mag2));
-    return mp_form_factor->evaluate(k_i, k_f1_bin, alpha_i, alpha_f) * V_eff;
-}
-
-void FormFactorPol::setSpecularInfo(const LayerSpecularInfo& layer_specular_info)
-{
-    delete mp_specular_info;
-    mp_specular_info = layer_specular_info.clone();
-}
diff --git a/Core/FormFactors/src/FormFactorWeighted.cpp b/Core/FormFactors/src/FormFactorWeighted.cpp
index bccb6391fe9825b124347e43d4ba5dcb11bca940..124df77c156f811956fef202d4306c77b45dade1 100644
--- a/Core/FormFactors/src/FormFactorWeighted.cpp
+++ b/Core/FormFactors/src/FormFactorWeighted.cpp
@@ -51,11 +51,25 @@ void FormFactorWeighted::setAmbientMaterial(const IMaterial *p_material)
     }
 }
 
-complex_t FormFactorWeighted::evaluate(const cvector_t& k_i, const Bin1DCVector& k_f_bin, double alpha_i, double alpha_f) const
+complex_t FormFactorWeighted::evaluate(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
 {
     complex_t result(0.0, 0.0);
     for (size_t index=0; index<m_form_factors.size(); ++index) {
-        complex_t ff_evaluate = m_form_factors[index]->evaluate(k_i, k_f_bin, alpha_i, alpha_f);
+        complex_t ff_evaluate = m_form_factors[index]->evaluate(k_i, k_f_bin,
+                alpha_f_bin);
+        result += m_weights[index]*ff_evaluate;
+    }
+    return result;
+}
+
+Eigen::Matrix2cd FormFactorWeighted::evaluatePol(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin, Bin1D phi_f_bin) const
+{
+    Eigen::Matrix2cd result = Eigen::Matrix2cd::Zero();
+    for (size_t index=0; index<m_form_factors.size(); ++index) {
+        Eigen::Matrix2cd ff_evaluate = m_form_factors[index]->evaluatePol(
+                k_i, k_f_bin, alpha_f_bin, phi_f_bin);
         result += m_weights[index]*ff_evaluate;
     }
     return result;
@@ -70,4 +84,3 @@ int FormFactorWeighted::getNumberOfStochasticParameters() const
     return result;
 }
 
-
diff --git a/Core/FormFactors/src/IFormFactorBorn.cpp b/Core/FormFactors/src/IFormFactorBorn.cpp
index 7143d86dd9dfab6a0cb4344c28901405a71c8486..e87634c82cab86a009727bd45ce4c6471cfcfbc7 100644
--- a/Core/FormFactors/src/IFormFactorBorn.cpp
+++ b/Core/FormFactors/src/IFormFactorBorn.cpp
@@ -17,6 +17,31 @@
 #include "MemberFunctionIntegrator.h"
 #include "MathFunctions.h"
 
+complex_t IFormFactorBorn::evaluate(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin) const
+{
+    (void)alpha_f_bin;
+    Bin1DCVector q_bin(k_i - k_f_bin.m_q_lower, k_i - k_f_bin.m_q_upper);
+    if (useLargeBinApproximation(q_bin)) {
+        return getVolume()*bigZPart(q_bin)*bigRadialPart(q_bin);
+    }
+    return evaluate_for_q(q_bin.getMidPoint());
+}
+
+Eigen::Matrix2cd IFormFactorBorn::evaluatePol(const cvector_t& k_i,
+        const Bin1DCVector& k_f_bin, Bin1D alpha_f_bin, Bin1D phi_f_bin) const
+{
+    (void)phi_f_bin;
+    Eigen::Matrix2cd unit_matrix = Eigen::Matrix2cd::Identity();
+    return evaluate(k_i, k_f_bin, alpha_f_bin) * unit_matrix;
+}
+
+double IFormFactorBorn::getVolume() const
+{
+    cvector_t zero;
+    return std::abs(evaluate_for_q(zero));
+}
+
 double IFormFactorBorn::bigRadialPart(const Bin1DCVector& q_bin) const
 {
     // modulus of the radial part
@@ -52,6 +77,19 @@ complex_t IFormFactorBorn::bigZPart(const Bin1DCVector& q_bin) const
     return z_phase*z_modulus;
 }
 
+bool IFormFactorBorn::useLargeBinApproximation(const Bin1DCVector& q_bin) const
+{
+    double delta_qr = std::abs( q_bin.getDelta().magxy() );
+    double delta_qz = std::abs( q_bin.getDelta().z() );
+    if (delta_qr == 0 || delta_qz == 0)
+        return false;
+    if ( delta_qr > M_PI/2/getRadius() )
+        return true;
+    if ( delta_qz > M_PI/2/getHeight() )
+        return true;
+    return false;
+}
+
 double IFormFactorBorn::bigRadialIntegrand(double t, void* params) const
 {
     const Bin1DCVector *p_q_bin = static_cast<const Bin1DCVector*>(params);
diff --git a/Core/Geometry/inc/BasicVector3D.h b/Core/Geometry/inc/BasicVector3D.h
index eb23955cd2bf12b63a46db98d874e4c7df65c1e2..302b5c086778d4a4e9e781e752dd9d08722f5996 100644
--- a/Core/Geometry/inc/BasicVector3D.h
+++ b/Core/Geometry/inc/BasicVector3D.h
@@ -37,10 +37,10 @@ namespace Geometry {
 //!
 template<class T>
 class BasicVector3D {
- protected:
+protected:
     T v_[3];
   
- public:
+public:
     //! Default constructor.
     //! It is protected - this class should not be instantiated directly.
     BasicVector3D()
diff --git a/Core/Geometry/inc/ITransform3D.h b/Core/Geometry/inc/ITransform3D.h
index 25f852cfe7cfec70d3d5e6140b7cef99b867d3fc..36849529b4fc7904cf7e897f184ec37f09823cdb 100644
--- a/Core/Geometry/inc/ITransform3D.h
+++ b/Core/Geometry/inc/ITransform3D.h
@@ -27,7 +27,7 @@ typedef boost::shared_ptr<class ITransform3D> PTransform3D;
 //! Interface to vector transforms in three dimensions.
 
 class ITransform3D {
- public:
+public:
 
     virtual ~ITransform3D() {}
 
diff --git a/Core/Geometry/inc/Rotate3D.h b/Core/Geometry/inc/Rotate3D.h
index f8e25f36c36b2181f8b2129f70554826bd640e5d..36219de6e5e4a39050609e8e5191458ecf923f44 100644
--- a/Core/Geometry/inc/Rotate3D.h
+++ b/Core/Geometry/inc/Rotate3D.h
@@ -22,7 +22,7 @@ namespace Geometry {
 //! Rotation around y axis.
 
 class RotateY_3D : public ITransform3D {
- public:
+public:
     //! Constructs a rotation by angle _a_.
 
     //! QUESTION: How can we construct identity transform for a=0?
@@ -57,7 +57,7 @@ class RotateY_3D : public ITransform3D {
     virtual void print(std::ostream& ostr) const
     { ostr << "Transform3D:Rotate_Y(" << m_ca << "," << m_sa << ")" ; }
 
- private:
+private:
     double m_ca, m_sa;
 
     //! Constructs a rotation by angle _a_ from cos(a) and sin(a).
@@ -68,7 +68,7 @@ class RotateY_3D : public ITransform3D {
 //! Rotation around z axis.
 
 class RotateZ_3D : public ITransform3D {
- public:
+public:
     //! Constructs a rotation by angle _a_.
 
     RotateZ_3D(double a)
@@ -98,7 +98,7 @@ class RotateZ_3D : public ITransform3D {
     virtual void print(std::ostream& ostr) const
     { ostr << "Transform3D:Rotate_Z(" << m_ca << "," << m_sa << ")" ; }
 
- private:
+private:
     double m_ca, m_sa;
 
     //! Constructs a rotation by angle _a_ from cos(a) and sin(a).
diff --git a/Core/PythonAPI/src/FormFactorBox.pypp.cpp b/Core/PythonAPI/src/FormFactorBox.pypp.cpp
index 4cfb36c1642108f22acb8681d4e48cbed300bfdf..a32713bd649a19080e1847792862bb2410f98d4a 100644
--- a/Core/PythonAPI/src/FormFactorBox.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorBox.pypp.cpp
@@ -157,16 +157,16 @@ struct FormFactorBox_wrapper : FormFactorBox, bp::wrapper< FormFactorBox > {
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -394,14 +394,14 @@ void register_FormFactorBox_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorBox_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorBox_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorBox_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorBox_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorCone.pypp.cpp b/Core/PythonAPI/src/FormFactorCone.pypp.cpp
index 7812713ccc58949254ac49a15bb41ab35cc97842..b4c262a46c4ad0d3c8420fdbcca40155da668ce5 100644
--- a/Core/PythonAPI/src/FormFactorCone.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorCone.pypp.cpp
@@ -121,16 +121,16 @@ struct FormFactorCone_wrapper : FormFactorCone, bp::wrapper< FormFactorCone > {
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -339,14 +339,14 @@ void register_FormFactorCone_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorCone_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorCone_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorCone_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorCone_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorCrystal.pypp.cpp b/Core/PythonAPI/src/FormFactorCrystal.pypp.cpp
index ee061f23c5ccb3b6bc0a9ee9d4affa4101cd1c53..d33b80f25ab0294b3ba201b31028f51972235a46 100644
--- a/Core/PythonAPI/src/FormFactorCrystal.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorCrystal.pypp.cpp
@@ -30,16 +30,16 @@ struct FormFactorCrystal_wrapper : FormFactorCrystal, bp::wrapper< FormFactorCry
         return FormFactorCrystal::clone( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->FormFactorCrystal::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->FormFactorCrystal::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return FormFactorCrystal::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return FormFactorCrystal::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::complex_t evaluate_for_q( ::cvector_t const & q ) const  {
@@ -263,14 +263,14 @@ void register_FormFactorCrystal_class(){
         }
         { //::FormFactorCrystal::evaluate
         
-            typedef ::complex_t ( ::FormFactorCrystal::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorCrystal_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::FormFactorCrystal::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorCrystal_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorCrystal_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::FormFactorCrystal::evaluate)
                 , default_evaluate_function_type(&FormFactorCrystal_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::FormFactorCrystal::evaluate_for_q
diff --git a/Core/PythonAPI/src/FormFactorCylinder.pypp.cpp b/Core/PythonAPI/src/FormFactorCylinder.pypp.cpp
index 2f4ad9eb452efc2caf1abc24d147c700d28931b7..240dd84db9f295af1968a470bfa20ad7fd4b0fba 100644
--- a/Core/PythonAPI/src/FormFactorCylinder.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorCylinder.pypp.cpp
@@ -169,16 +169,16 @@ struct FormFactorCylinder_wrapper : FormFactorCylinder, bp::wrapper< FormFactorC
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -422,14 +422,14 @@ void register_FormFactorCylinder_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorCylinder_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorCylinder_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorCylinder_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorCylinder_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorDecoratorDebyeWaller.pypp.cpp b/Core/PythonAPI/src/FormFactorDecoratorDebyeWaller.pypp.cpp
index 78e0cc193fdb6b2034228c8732b8a6683710711b..8a9e360a7a9b9d27e06a1229bd4abddded6e89d2 100644
--- a/Core/PythonAPI/src/FormFactorDecoratorDebyeWaller.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorDecoratorDebyeWaller.pypp.cpp
@@ -37,16 +37,16 @@ struct FormFactorDecoratorDebyeWaller_wrapper : FormFactorDecoratorDebyeWaller,
         return FormFactorDecoratorDebyeWaller::clone( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->FormFactorDecoratorDebyeWaller::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->FormFactorDecoratorDebyeWaller::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return FormFactorDecoratorDebyeWaller::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return FormFactorDecoratorDebyeWaller::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual int getNumberOfStochasticParameters(  ) const  {
@@ -258,14 +258,14 @@ void register_FormFactorDecoratorDebyeWaller_class(){
         }
         { //::FormFactorDecoratorDebyeWaller::evaluate
         
-            typedef ::complex_t ( ::FormFactorDecoratorDebyeWaller::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorDecoratorDebyeWaller_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::FormFactorDecoratorDebyeWaller::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorDecoratorDebyeWaller_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorDecoratorDebyeWaller_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::FormFactorDecoratorDebyeWaller::evaluate)
                 , default_evaluate_function_type(&FormFactorDecoratorDebyeWaller_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::FormFactorDecoratorDebyeWaller::getNumberOfStochasticParameters
diff --git a/Core/PythonAPI/src/FormFactorEllipsoid.pypp.cpp b/Core/PythonAPI/src/FormFactorEllipsoid.pypp.cpp
index 4007fad4e8e15b33adb23b8db070167cb2270198..70b768937454b922129637c26b36d41498af6b05 100644
--- a/Core/PythonAPI/src/FormFactorEllipsoid.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorEllipsoid.pypp.cpp
@@ -157,16 +157,16 @@ struct FormFactorEllipsoid_wrapper : FormFactorEllipsoid, bp::wrapper< FormFacto
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -394,14 +394,14 @@ void register_FormFactorEllipsoid_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorEllipsoid_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorEllipsoid_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorEllipsoid_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorEllipsoid_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorFullSphere.pypp.cpp b/Core/PythonAPI/src/FormFactorFullSphere.pypp.cpp
index c8d27dcbb49ab63466ac73f94e43da5bc5bcc865..af6e979baeca09ab9484885ec9a11f2945517bdd 100644
--- a/Core/PythonAPI/src/FormFactorFullSphere.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorFullSphere.pypp.cpp
@@ -157,16 +157,16 @@ struct FormFactorFullSphere_wrapper : FormFactorFullSphere, bp::wrapper< FormFac
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -398,14 +398,14 @@ void register_FormFactorFullSphere_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorFullSphere_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorFullSphere_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorFullSphere_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorFullSphere_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorFullSpheroid.pypp.cpp b/Core/PythonAPI/src/FormFactorFullSpheroid.pypp.cpp
index c8f959233fcee461230aad3a599ea1aa73596c7a..42b5a282887e9f568065043ba45e345e07dc2883 100644
--- a/Core/PythonAPI/src/FormFactorFullSpheroid.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorFullSpheroid.pypp.cpp
@@ -121,16 +121,16 @@ struct FormFactorFullSpheroid_wrapper : FormFactorFullSpheroid, bp::wrapper< For
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -339,14 +339,14 @@ void register_FormFactorFullSpheroid_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorFullSpheroid_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorFullSpheroid_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorFullSpheroid_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorFullSpheroid_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorGauss.pypp.cpp b/Core/PythonAPI/src/FormFactorGauss.pypp.cpp
index 654931461a99f7e83e4288aa1fb124f7c6f85f07..a15262b4836ad9293beeb7bdcc43afa14ee9e73a 100644
--- a/Core/PythonAPI/src/FormFactorGauss.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorGauss.pypp.cpp
@@ -128,16 +128,16 @@ struct FormFactorGauss_wrapper : FormFactorGauss, bp::wrapper< FormFactorGauss >
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -360,14 +360,14 @@ void register_FormFactorGauss_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorGauss_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorGauss_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorGauss_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorGauss_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorHemiSpheroid.pypp.cpp b/Core/PythonAPI/src/FormFactorHemiSpheroid.pypp.cpp
index da829336c44def37b521b05827e5d33c4d0139eb..43f766aaa928abe374f3a053c63ba15120438aec 100644
--- a/Core/PythonAPI/src/FormFactorHemiSpheroid.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorHemiSpheroid.pypp.cpp
@@ -121,16 +121,16 @@ struct FormFactorHemiSpheroid_wrapper : FormFactorHemiSpheroid, bp::wrapper< For
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -339,14 +339,14 @@ void register_FormFactorHemiSpheroid_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorHemiSpheroid_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorHemiSpheroid_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorHemiSpheroid_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorHemiSpheroid_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorLorentz.pypp.cpp b/Core/PythonAPI/src/FormFactorLorentz.pypp.cpp
index 69552f832fa51908886f0ce4ab0ebd744cff8658..90327dd6a6eccb6260a178ad927db10ef279e42c 100644
--- a/Core/PythonAPI/src/FormFactorLorentz.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorLorentz.pypp.cpp
@@ -128,16 +128,16 @@ struct FormFactorLorentz_wrapper : FormFactorLorentz, bp::wrapper< FormFactorLor
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -360,14 +360,14 @@ void register_FormFactorLorentz_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorLorentz_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorLorentz_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorLorentz_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorLorentz_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorParallelepiped.pypp.cpp b/Core/PythonAPI/src/FormFactorParallelepiped.pypp.cpp
index f86d420b8d9a8302b30d6a67b181412fa66fd1a7..9cc5960eefe4265774ced8f226b2106ee48cdbd1 100644
--- a/Core/PythonAPI/src/FormFactorParallelepiped.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorParallelepiped.pypp.cpp
@@ -157,16 +157,16 @@ struct FormFactorParallelepiped_wrapper : FormFactorParallelepiped, bp::wrapper<
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -385,14 +385,14 @@ void register_FormFactorParallelepiped_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorParallelepiped_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorParallelepiped_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorParallelepiped_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorParallelepiped_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorPrism3.pypp.cpp b/Core/PythonAPI/src/FormFactorPrism3.pypp.cpp
index 2830f3e6654d1f9cd761d892bd61eb4492dbb2ec..91ebcc9ecfeaa572dfe13b35b36c269ed5d7fc6a 100644
--- a/Core/PythonAPI/src/FormFactorPrism3.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorPrism3.pypp.cpp
@@ -169,16 +169,16 @@ struct FormFactorPrism3_wrapper : FormFactorPrism3, bp::wrapper< FormFactorPrism
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -434,14 +434,14 @@ void register_FormFactorPrism3_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorPrism3_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorPrism3_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorPrism3_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorPrism3_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorPrism6.pypp.cpp b/Core/PythonAPI/src/FormFactorPrism6.pypp.cpp
index c7448a98fca7057be382d972145f2f1f47929f87..8442d80023dfe1ac2717eca014040650feab4f21 100644
--- a/Core/PythonAPI/src/FormFactorPrism6.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorPrism6.pypp.cpp
@@ -133,16 +133,16 @@ struct FormFactorPrism6_wrapper : FormFactorPrism6, bp::wrapper< FormFactorPrism
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -363,14 +363,14 @@ void register_FormFactorPrism6_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorPrism6_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorPrism6_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorPrism6_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorPrism6_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorPyramid.pypp.cpp b/Core/PythonAPI/src/FormFactorPyramid.pypp.cpp
index a2729ffcebd5eee41a42e6f6f798a9d6219cfacb..2146af388f536ca40155a4a51495b58395fcf02e 100644
--- a/Core/PythonAPI/src/FormFactorPyramid.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorPyramid.pypp.cpp
@@ -193,16 +193,16 @@ struct FormFactorPyramid_wrapper : FormFactorPyramid, bp::wrapper< FormFactorPyr
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -481,14 +481,14 @@ void register_FormFactorPyramid_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorPyramid_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorPyramid_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorPyramid_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorPyramid_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorSphere.pypp.cpp b/Core/PythonAPI/src/FormFactorSphere.pypp.cpp
index 5291f63e3abdce667499733802ea96469270c640..3bdf99073efb0633293b9c3ec029402bf17ba136 100644
--- a/Core/PythonAPI/src/FormFactorSphere.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorSphere.pypp.cpp
@@ -121,16 +121,16 @@ struct FormFactorSphere_wrapper : FormFactorSphere, bp::wrapper< FormFactorSpher
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -339,14 +339,14 @@ void register_FormFactorSphere_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorSphere_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorSphere_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorSphere_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorSphere_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/FormFactorSphereGaussianRadius.pypp.cpp b/Core/PythonAPI/src/FormFactorSphereGaussianRadius.pypp.cpp
index dcc3c5f984d3d7b028603ced7ce629ce0d2a668f..557fc18c9a93d9b71d3d120a8acf9a83dbb3872a 100644
--- a/Core/PythonAPI/src/FormFactorSphereGaussianRadius.pypp.cpp
+++ b/Core/PythonAPI/src/FormFactorSphereGaussianRadius.pypp.cpp
@@ -145,16 +145,16 @@ struct FormFactorSphereGaussianRadius_wrapper : FormFactorSphereGaussianRadius,
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -374,14 +374,14 @@ void register_FormFactorSphereGaussianRadius_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( FormFactorSphereGaussianRadius_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( FormFactorSphereGaussianRadius_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             FormFactorSphereGaussianRadius_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&FormFactorSphereGaussianRadius_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/IFormFactor.pypp.cpp b/Core/PythonAPI/src/IFormFactor.pypp.cpp
index 7a91b6b9785ff4e645b97beedb2372f670216e1e..a4604b0dc84fc6f9f5013596ac2a6147833f4721 100644
--- a/Core/PythonAPI/src/IFormFactor.pypp.cpp
+++ b/Core/PythonAPI/src/IFormFactor.pypp.cpp
@@ -42,9 +42,9 @@ struct IFormFactor_wrapper : IFormFactor, bp::wrapper< IFormFactor > {
         IFormFactor::createDistributedFormFactors( boost::ref(form_factors), boost::ref(probabilities), nbr_samples );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const {
         bp::override func_evaluate = this->get_override( "evaluate" );
-        return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+        return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual double getHeight(  ) const  {
@@ -255,12 +255,12 @@ void register_IFormFactor_class(){
         }
         { //::IFormFactor::evaluate
         
-            typedef ::complex_t ( ::IFormFactor::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactor::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             IFormFactor_exposer.def( 
                 "evaluate"
                 , bp::pure_virtual( evaluate_function_type(&::IFormFactor::evaluate) )
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::IFormFactor::getHeight
diff --git a/Core/PythonAPI/src/IFormFactorBorn.pypp.cpp b/Core/PythonAPI/src/IFormFactorBorn.pypp.cpp
index 1696e4110c52e8fc05b0cd359d58088fde87defc..58832bef87c1124615c7a957d0a25580128a72c5 100644
--- a/Core/PythonAPI/src/IFormFactorBorn.pypp.cpp
+++ b/Core/PythonAPI/src/IFormFactorBorn.pypp.cpp
@@ -30,16 +30,16 @@ struct IFormFactorBorn_wrapper : IFormFactorBorn, bp::wrapper< IFormFactorBorn >
         return func_clone(  );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
         if( bp::override func_evaluate = this->get_override( "evaluate" ) )
-            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         else{
-            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+            return this->IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
         }
     }
     
-    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const  {
-        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+    ::complex_t default_evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const  {
+        return IFormFactorBorn::evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::complex_t evaluate_for_q( ::cvector_t const & q ) const {
@@ -254,14 +254,14 @@ void register_IFormFactorBorn_class(){
         }
         { //::IFormFactorBorn::evaluate
         
-            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
-            typedef ::complex_t ( IFormFactorBorn_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactorBorn::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
+            typedef ::complex_t ( IFormFactorBorn_wrapper::*default_evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             IFormFactorBorn_exposer.def( 
                 "evaluate"
                 , evaluate_function_type(&::IFormFactorBorn::evaluate)
                 , default_evaluate_function_type(&IFormFactorBorn_wrapper::default_evaluate)
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::IFormFactorBorn::evaluate_for_q
diff --git a/Core/PythonAPI/src/IFormFactorDecorator.pypp.cpp b/Core/PythonAPI/src/IFormFactorDecorator.pypp.cpp
index 71fd9f8af4c5882c8070baaee9f93fd9cedfd845..4e17d6fbeb12be48be1e549969a4873e0c3d2063 100644
--- a/Core/PythonAPI/src/IFormFactorDecorator.pypp.cpp
+++ b/Core/PythonAPI/src/IFormFactorDecorator.pypp.cpp
@@ -119,9 +119,9 @@ struct IFormFactorDecorator_wrapper : IFormFactorDecorator, bp::wrapper< IFormFa
         return IParameterized::createParameterTree( );
     }
 
-    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, double alpha_i, double alpha_f ) const {
+    virtual ::complex_t evaluate( ::cvector_t const & k_i, ::Bin1DCVector const & k_f_bin, ::Bin1D alpha_f_bin ) const {
         bp::override func_evaluate = this->get_override( "evaluate" );
-        return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_i, alpha_f );
+        return func_evaluate( boost::ref(k_i), boost::ref(k_f_bin), alpha_f_bin );
     }
 
     virtual ::ICompositeSample const * getCompositeSample(  ) const  {
@@ -327,12 +327,12 @@ void register_IFormFactorDecorator_class(){
         }
         { //::IFormFactor::evaluate
         
-            typedef ::complex_t ( ::IFormFactor::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,double,double ) const;
+            typedef ::complex_t ( ::IFormFactor::*evaluate_function_type )( ::cvector_t const &,::Bin1DCVector const &,::Bin1D ) const;
             
             IFormFactorDecorator_exposer.def( 
                 "evaluate"
                 , bp::pure_virtual( evaluate_function_type(&::IFormFactor::evaluate) )
-                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_i"), bp::arg("alpha_f") ) );
+                , ( bp::arg("k_i"), bp::arg("k_f_bin"), bp::arg("alpha_f_bin") ) );
         
         }
         { //::ISample::getCompositeSample
diff --git a/Core/PythonAPI/src/LatticeBasis.pypp.cpp b/Core/PythonAPI/src/LatticeBasis.pypp.cpp
index 54242e6ff07ff64259370db314fbec0ef31dde0f..e144b5a5d9585778499684d7fdcdd8e8357a7094 100644
--- a/Core/PythonAPI/src/LatticeBasis.pypp.cpp
+++ b/Core/PythonAPI/src/LatticeBasis.pypp.cpp
@@ -164,6 +164,18 @@ struct LatticeBasis_wrapper : LatticeBasis, bp::wrapper< LatticeBasis > {
         IParameterized::setParametersAreChanged( );
     }
 
+    virtual void setTransform( ::Geometry::PTransform3D const & transform ) {
+        if( bp::override func_setTransform = this->get_override( "setTransform" ) )
+            func_setTransform( transform );
+        else{
+            this->Particle::setTransform( transform );
+        }
+    }
+    
+    void default_setTransform( ::Geometry::PTransform3D const & transform ) {
+        Particle::setTransform( transform );
+    }
+
 };
 
 void register_LatticeBasis_class(){
@@ -306,6 +318,18 @@ void register_LatticeBasis_class(){
                 , default_setParametersAreChanged_function_type(&LatticeBasis_wrapper::default_setParametersAreChanged) );
         
         }
+        { //::Particle::setTransform
+        
+            typedef void ( ::Particle::*setTransform_function_type )( ::Geometry::PTransform3D const & ) ;
+            typedef void ( LatticeBasis_wrapper::*default_setTransform_function_type )( ::Geometry::PTransform3D const & ) ;
+            
+            LatticeBasis_exposer.def( 
+                "setTransform"
+                , setTransform_function_type(&::Particle::setTransform)
+                , default_setTransform_function_type(&LatticeBasis_wrapper::default_setTransform)
+                , ( bp::arg("transform") ) );
+        
+        }
     }
 
 }
diff --git a/Core/PythonAPI/src/MesoCrystal.pypp.cpp b/Core/PythonAPI/src/MesoCrystal.pypp.cpp
index f22e5a37ef3f32c535d2d0bf35863f2f01489ed8..ec1cffea82e478bab2972376976646ea0d3aa9de 100644
--- a/Core/PythonAPI/src/MesoCrystal.pypp.cpp
+++ b/Core/PythonAPI/src/MesoCrystal.pypp.cpp
@@ -152,6 +152,18 @@ struct MesoCrystal_wrapper : MesoCrystal, bp::wrapper< MesoCrystal > {
         IParameterized::setParametersAreChanged( );
     }
 
+    virtual void setTransform( ::Geometry::PTransform3D const & transform ) {
+        if( bp::override func_setTransform = this->get_override( "setTransform" ) )
+            func_setTransform( transform );
+        else{
+            this->Particle::setTransform( transform );
+        }
+    }
+    
+    void default_setTransform( ::Geometry::PTransform3D const & transform ) {
+        Particle::setTransform( transform );
+    }
+
 };
 
 void register_MesoCrystal_class(){
@@ -272,6 +284,18 @@ void register_MesoCrystal_class(){
                 , default_setParametersAreChanged_function_type(&MesoCrystal_wrapper::default_setParametersAreChanged) );
         
         }
+        { //::Particle::setTransform
+        
+            typedef void ( ::Particle::*setTransform_function_type )( ::Geometry::PTransform3D const & ) ;
+            typedef void ( MesoCrystal_wrapper::*default_setTransform_function_type )( ::Geometry::PTransform3D const & ) ;
+            
+            MesoCrystal_exposer.def( 
+                "setTransform"
+                , setTransform_function_type(&::Particle::setTransform)
+                , default_setTransform_function_type(&MesoCrystal_wrapper::default_setTransform)
+                , ( bp::arg("transform") ) );
+        
+        }
     }
 
 }
diff --git a/Core/PythonAPI/src/Particle.pypp.cpp b/Core/PythonAPI/src/Particle.pypp.cpp
index 2746d799fe8304a3a0f98ec6695257630ba40b55..121031657ed8eec0e7bbaf8b02ec9c063f594d5a 100644
--- a/Core/PythonAPI/src/Particle.pypp.cpp
+++ b/Core/PythonAPI/src/Particle.pypp.cpp
@@ -56,16 +56,16 @@ struct Particle_wrapper : Particle, bp::wrapper< Particle > {
         return Particle::cloneInvertB( );
     }
 
-    virtual ::IFormFactor * createFormFactor(  ) const  {
+    virtual ::IFormFactor * createFormFactor( ::complex_t wavevector_scattering_factor ) const  {
         if( bp::override func_createFormFactor = this->get_override( "createFormFactor" ) )
-            return func_createFormFactor(  );
+            return func_createFormFactor( wavevector_scattering_factor );
         else{
-            return this->Particle::createFormFactor(  );
+            return this->Particle::createFormFactor( wavevector_scattering_factor );
         }
     }
     
-    ::IFormFactor * default_createFormFactor(  ) const  {
-        return Particle::createFormFactor( );
+    ::IFormFactor * default_createFormFactor( ::complex_t wavevector_scattering_factor ) const  {
+        return Particle::createFormFactor( wavevector_scattering_factor );
     }
 
     virtual ::IMaterial const * getMaterial(  ) const  {
@@ -116,6 +116,18 @@ struct Particle_wrapper : Particle, bp::wrapper< Particle > {
         return Particle::hasDistributedFormFactor( );
     }
 
+    virtual void setTransform( ::Geometry::PTransform3D const & transform ) {
+        if( bp::override func_setTransform = this->get_override( "setTransform" ) )
+            func_setTransform( transform );
+        else{
+            this->Particle::setTransform( transform );
+        }
+    }
+    
+    void default_setTransform( ::Geometry::PTransform3D const & transform ) {
+        Particle::setTransform( transform );
+    }
+
     virtual bool areParametersChanged(  ) {
         if( bp::override func_areParametersChanged = this->get_override( "areParametersChanged" ) )
             return func_areParametersChanged(  );
@@ -242,13 +254,14 @@ void register_Particle_class(){
         }
         { //::Particle::createFormFactor
         
-            typedef ::IFormFactor * ( ::Particle::*createFormFactor_function_type )(  ) const;
-            typedef ::IFormFactor * ( Particle_wrapper::*default_createFormFactor_function_type )(  ) const;
+            typedef ::IFormFactor * ( ::Particle::*createFormFactor_function_type )( ::complex_t ) const;
+            typedef ::IFormFactor * ( Particle_wrapper::*default_createFormFactor_function_type )( ::complex_t ) const;
             
             Particle_exposer.def( 
                 "createFormFactor"
                 , createFormFactor_function_type(&::Particle::createFormFactor)
                 , default_createFormFactor_function_type(&Particle_wrapper::default_createFormFactor)
+                , ( bp::arg("wavevector_scattering_factor") )
                 , bp::return_value_policy< bp::manage_new_object >() );
         
         }
@@ -263,6 +276,15 @@ void register_Particle_class(){
                 , default_getMaterial_function_type(&Particle_wrapper::default_getMaterial)
                 , bp::return_value_policy< bp::reference_existing_object >() );
         
+        }
+        { //::Particle::getPTransform3D
+        
+            typedef ::Geometry::PTransform3D const ( ::Particle::*getPTransform3D_function_type )(  ) const;
+            
+            Particle_exposer.def( 
+                "getPTransform3D"
+                , getPTransform3D_function_type( &::Particle::getPTransform3D ) );
+        
         }
         { //::Particle::getRefractiveIndex
         
@@ -297,6 +319,18 @@ void register_Particle_class(){
                 , hasDistributedFormFactor_function_type(&::Particle::hasDistributedFormFactor)
                 , default_hasDistributedFormFactor_function_type(&Particle_wrapper::default_hasDistributedFormFactor) );
         
+        }
+        { //::Particle::setTransform
+        
+            typedef void ( ::Particle::*setTransform_function_type )( ::Geometry::PTransform3D const & ) ;
+            typedef void ( Particle_wrapper::*default_setTransform_function_type )( ::Geometry::PTransform3D const & ) ;
+            
+            Particle_exposer.def( 
+                "setTransform"
+                , setTransform_function_type(&::Particle::setTransform)
+                , default_setTransform_function_type(&Particle_wrapper::default_setTransform)
+                , ( bp::arg("transform") ) );
+        
         }
         { //::IParameterized::areParametersChanged
         
diff --git a/Core/PythonAPI/src/ParticleCoreShell.pypp.cpp b/Core/PythonAPI/src/ParticleCoreShell.pypp.cpp
index 62b9152e2edca9fadd02fcd14704139cffbeeeec..6482b19436a385a509667c7b827a68271d65fb57 100644
--- a/Core/PythonAPI/src/ParticleCoreShell.pypp.cpp
+++ b/Core/PythonAPI/src/ParticleCoreShell.pypp.cpp
@@ -152,6 +152,18 @@ struct ParticleCoreShell_wrapper : ParticleCoreShell, bp::wrapper< ParticleCoreS
         IParameterized::setParametersAreChanged( );
     }
 
+    virtual void setTransform( ::Geometry::PTransform3D const & transform ) {
+        if( bp::override func_setTransform = this->get_override( "setTransform" ) )
+            func_setTransform( transform );
+        else{
+            this->Particle::setTransform( transform );
+        }
+    }
+    
+    void default_setTransform( ::Geometry::PTransform3D const & transform ) {
+        Particle::setTransform( transform );
+    }
+
 };
 
 void register_ParticleCoreShell_class(){
@@ -272,6 +284,18 @@ void register_ParticleCoreShell_class(){
                 , default_setParametersAreChanged_function_type(&ParticleCoreShell_wrapper::default_setParametersAreChanged) );
         
         }
+        { //::Particle::setTransform
+        
+            typedef void ( ::Particle::*setTransform_function_type )( ::Geometry::PTransform3D const & ) ;
+            typedef void ( ParticleCoreShell_wrapper::*default_setTransform_function_type )( ::Geometry::PTransform3D const & ) ;
+            
+            ParticleCoreShell_exposer.def( 
+                "setTransform"
+                , setTransform_function_type(&::Particle::setTransform)
+                , default_setTransform_function_type(&ParticleCoreShell_wrapper::default_setTransform)
+                , ( bp::arg("transform") ) );
+        
+        }
     }
 
 }
diff --git a/Core/PythonAPI/src/ParticleInfo.pypp.cpp b/Core/PythonAPI/src/ParticleInfo.pypp.cpp
index a0f60dc367fb6c0762b2b4074a06486b3e58cf60..39d6486289534ef1286a49f5f621ba9149810e0a 100644
--- a/Core/PythonAPI/src/ParticleInfo.pypp.cpp
+++ b/Core/PythonAPI/src/ParticleInfo.pypp.cpp
@@ -18,13 +18,6 @@ namespace bp = boost::python;
 
 struct ParticleInfo_wrapper : ParticleInfo, bp::wrapper< ParticleInfo > {
 
-    ParticleInfo_wrapper(::Particle const & p_particle, ::Geometry::PTransform3D const & transform, double depth=0, double abundance=0 )
-    : ParticleInfo( boost::ref(p_particle), transform, depth, abundance )
-      , bp::wrapper< ParticleInfo >(){
-        // constructor
-    
-    }
-
     ParticleInfo_wrapper(::Particle const & p_particle, double depth=0, double abundance=0 )
     : ParticleInfo( boost::ref(p_particle), depth, abundance )
       , bp::wrapper< ParticleInfo >(){
@@ -153,9 +146,8 @@ void register_ParticleInfo_class(){
 
     { //::ParticleInfo
         typedef bp::class_< ParticleInfo_wrapper, bp::bases< ICompositeSample >, boost::noncopyable > ParticleInfo_exposer_t;
-        ParticleInfo_exposer_t ParticleInfo_exposer = ParticleInfo_exposer_t( "ParticleInfo", bp::init< Particle const &, Geometry::PTransform3D const &, bp::optional< double, double > >(( bp::arg("p_particle"), bp::arg("transform"), bp::arg("depth")=0, bp::arg("abundance")=0 )) );
+        ParticleInfo_exposer_t ParticleInfo_exposer = ParticleInfo_exposer_t( "ParticleInfo", bp::init< Particle const &, bp::optional< double, double > >(( bp::arg("p_particle"), bp::arg("depth")=0, bp::arg("abundance")=0 )) );
         bp::scope ParticleInfo_scope( ParticleInfo_exposer );
-        ParticleInfo_exposer.def( bp::init< Particle const &, bp::optional< double, double > >(( bp::arg("p_particle"), bp::arg("depth")=0, bp::arg("abundance")=0 )) );
         { //::ParticleInfo::clone
         
             typedef ::ParticleInfo * ( ::ParticleInfo::*clone_function_type )(  ) const;
@@ -197,15 +189,6 @@ void register_ParticleInfo_class(){
                 "getDepth"
                 , getDepth_function_type( &::ParticleInfo::getDepth ) );
         
-        }
-        { //::ParticleInfo::getPTransform3D
-        
-            typedef ::Geometry::PTransform3D const ( ::ParticleInfo::*getPTransform3D_function_type )(  ) const;
-            
-            ParticleInfo_exposer.def( 
-                "getPTransform3D"
-                , getPTransform3D_function_type( &::ParticleInfo::getPTransform3D ) );
-        
         }
         { //::ParticleInfo::getParticle
         
@@ -236,16 +219,6 @@ void register_ParticleInfo_class(){
                 , setDepth_function_type( &::ParticleInfo::setDepth )
                 , ( bp::arg("depth") ) );
         
-        }
-        { //::ParticleInfo::setTransform
-        
-            typedef void ( ::ParticleInfo::*setTransform_function_type )( ::Geometry::PTransform3D const & ) ;
-            
-            ParticleInfo_exposer.def( 
-                "setTransform"
-                , setTransform_function_type( &::ParticleInfo::setTransform )
-                , ( bp::arg("transform") ) );
-        
         }
         { //::IParameterized::areParametersChanged
         
diff --git a/Core/PythonAPI/src/PositionParticleInfo.pypp.cpp b/Core/PythonAPI/src/PositionParticleInfo.pypp.cpp
index 5b1ff40c209766a9353aac32db9df99e41cc9d2e..dfbc61d5090767f4e0b2d4e4b83ba8f9e508b70d 100644
--- a/Core/PythonAPI/src/PositionParticleInfo.pypp.cpp
+++ b/Core/PythonAPI/src/PositionParticleInfo.pypp.cpp
@@ -18,13 +18,6 @@ namespace bp = boost::python;
 
 struct PositionParticleInfo_wrapper : PositionParticleInfo, bp::wrapper< PositionParticleInfo > {
 
-    PositionParticleInfo_wrapper(::Particle const & particle, ::Geometry::PTransform3D const & transform, ::kvector_t position, double abundance=0 )
-    : PositionParticleInfo( boost::ref(particle), transform, position, abundance )
-      , bp::wrapper< PositionParticleInfo >(){
-        // constructor
-    
-    }
-
     PositionParticleInfo_wrapper(::Particle const & particle, ::kvector_t position, double abundance=0 )
     : PositionParticleInfo( boost::ref(particle), position, abundance )
       , bp::wrapper< PositionParticleInfo >(){
@@ -153,9 +146,8 @@ void register_PositionParticleInfo_class(){
 
     { //::PositionParticleInfo
         typedef bp::class_< PositionParticleInfo_wrapper, bp::bases< ParticleInfo >, boost::noncopyable > PositionParticleInfo_exposer_t;
-        PositionParticleInfo_exposer_t PositionParticleInfo_exposer = PositionParticleInfo_exposer_t( "PositionParticleInfo", bp::init< Particle const &, Geometry::PTransform3D const &, kvector_t, bp::optional< double > >(( bp::arg("particle"), bp::arg("transform"), bp::arg("position"), bp::arg("abundance")=0 )) );
+        PositionParticleInfo_exposer_t PositionParticleInfo_exposer = PositionParticleInfo_exposer_t( "PositionParticleInfo", bp::init< Particle const &, kvector_t, bp::optional< double > >(( bp::arg("particle"), bp::arg("position"), bp::arg("abundance")=0 )) );
         bp::scope PositionParticleInfo_scope( PositionParticleInfo_exposer );
-        PositionParticleInfo_exposer.def( bp::init< Particle const &, kvector_t, bp::optional< double > >(( bp::arg("particle"), bp::arg("position"), bp::arg("abundance")=0 )) );
         { //::PositionParticleInfo::clone
         
             typedef ::PositionParticleInfo * ( ::PositionParticleInfo::*clone_function_type )(  ) const;
diff --git a/Core/Samples/inc/Crystal.h b/Core/Samples/inc/Crystal.h
index 8c0f999029a9546c9f642ab4cc9083fb1bfd4e8f..1349557746c1df7677c85b9ffb5da455fedc64fb 100644
--- a/Core/Samples/inc/Crystal.h
+++ b/Core/Samples/inc/Crystal.h
@@ -42,7 +42,8 @@ public:
 
     virtual IFormFactor *createTotalFormFactor(
         const IFormFactor& meso_crystal_form_factor,
-        const IMaterial *p_ambient_material) const;
+        const IMaterial *p_ambient_material,
+        complex_t wavevector_scattering_factor) const;
 
     Lattice getLattice() const { return m_lattice; }
     Particle *createBasis() const { return mp_lattice_basis->clone(); }
diff --git a/Core/Samples/inc/DiffuseParticleInfo.h b/Core/Samples/inc/DiffuseParticleInfo.h
index 3394020770f33519d73fd6911e4839bcb22e0c77..de08661b78cd761701606e977b8f67d269b53ff1 100644
--- a/Core/Samples/inc/DiffuseParticleInfo.h
+++ b/Core/Samples/inc/DiffuseParticleInfo.h
@@ -25,9 +25,8 @@ class BA_CORE_API_ DiffuseParticleInfo : public ParticleInfo
 public:
     DiffuseParticleInfo(
         Particle *p_particle,
-        const Geometry::PTransform3D& transform = Geometry::PTransform3D(),
         double depth=0, double abundance=0)
-        : ParticleInfo(p_particle, transform, depth, abundance)
+        : ParticleInfo(p_particle, depth, abundance)
         , m_number_per_meso(0.0)
         , m_height_range(0.0) {}
 
diff --git a/Core/Samples/inc/HomogeneousMagneticMaterial.h b/Core/Samples/inc/HomogeneousMagneticMaterial.h
index 7fefc39b47910b77c933e1684d57b2ae59b4a6bc..c235bbc12d93c7fe7ee04c0b1341c6ee34271d87 100644
--- a/Core/Samples/inc/HomogeneousMagneticMaterial.h
+++ b/Core/Samples/inc/HomogeneousMagneticMaterial.h
@@ -17,7 +17,9 @@
 #define HOMOGENEOUSMAGNETICMATERIAL_H_
 
 #include "HomogeneousMaterial.h"
+#ifndef GCCXML_SKIP_THIS
 #include <Eigen/Core>
+#endif
 
 //! An homogeneous material with magnetization
 
@@ -71,8 +73,10 @@ private:
     static const double m_magnetic_prefactor;
 
     //! The unit matrix
+#ifndef GCCXML_SKIP_THIS
     Eigen::Matrix2cd m_unit_matrix;
     std::vector<Eigen::Matrix2cd> m_pauli_operator;
+#endif
 };
 
 
diff --git a/Core/Samples/inc/IClusteredParticles.h b/Core/Samples/inc/IClusteredParticles.h
index 47ab84c8c0cab8bbb04ee6eb69304b1e38681c71..cdbf0ca77756b8b992cedfcc1b379b2c462ef3ed 100644
--- a/Core/Samples/inc/IClusteredParticles.h
+++ b/Core/Samples/inc/IClusteredParticles.h
@@ -53,10 +53,12 @@ public:
     //! IClusteredParticles object itself
     virtual IFormFactor *createTotalFormFactor(
            const IFormFactor& meso_crystal_form_factor,
-           const IMaterial *p_ambient_material) const
+           const IMaterial *p_ambient_material,
+           complex_t wavevector_scattering_factor) const
     {
         (void)meso_crystal_form_factor;
         (void)p_ambient_material;
+        (void)wavevector_scattering_factor;
         throw NotImplementedException(
                 "IClusteredParticles::createTotalFormFactor() "
                 "-> NotImplementedException");
@@ -70,7 +72,6 @@ public:
                 "IClusteredParticles::createDiffuseParticleInfo() "
                 "-> NotImplementedException");
     }
-
 };
 
 #endif /* ICLUSTEREDNANOPARTICLES_H_ */
diff --git a/Core/Samples/inc/ICompositeIterator.h b/Core/Samples/inc/ICompositeIterator.h
index 6c6c8a5e77b45a515cc60ee26fe14b686a219cb9..933f4ac820065d4899f38408f244d6e8bbe0993d 100644
--- a/Core/Samples/inc/ICompositeIterator.h
+++ b/Core/Samples/inc/ICompositeIterator.h
@@ -27,7 +27,7 @@
 
 class MementoState
 {
- public:
+public:
     typedef std::list<ISample*>::iterator iterator_t;
 
     MementoState(iterator_t itor, iterator_t end_itor)
@@ -51,11 +51,11 @@ class MementoState
     friend std::ostream& operator<<(std::ostream& o, MementoState const& m)
     { return  (o << "memento state " <<& m.m_itor << " " <<& m.m_end_itor); }
 
- protected:
+protected:
     iterator_t m_itor;
     iterator_t m_end_itor;
 
- private:
+private:
     MementoState();
 };
 
@@ -64,7 +64,7 @@ class MementoState
 
 class MementoIterator
 {
- public:
+public:
     MementoIterator() {}
     virtual ~MementoIterator() {}
 
@@ -77,7 +77,7 @@ class MementoIterator
     { return m_state_stack.top().get_itor(); }
     void next() { m_state_stack.top().next(); }
     size_t size() { return m_state_stack.size(); }
- protected:
+protected:
     std::stack<MementoState > m_state_stack;
 };
 
@@ -94,7 +94,7 @@ class MementoIterator
 
 class ICompositeIterator
 {
- public:
+public:
     ICompositeIterator(ICompositeSample *root) : m_root(root), m_done(false) {}
     virtual ~ICompositeIterator() {}
 
@@ -103,7 +103,7 @@ class ICompositeIterator
     ISample* get_current() { return *(m_memento_itor.get_current_itor()); }
     bool is_done() { return m_done; }
     size_t get_level() { return m_memento_itor.size(); }
- protected:
+protected:
     MementoIterator m_memento_itor;
     ICompositeSample* m_root;
     bool m_done;
diff --git a/Core/Samples/inc/ICompositeSample.h b/Core/Samples/inc/ICompositeSample.h
index 18ee829362a07b98d3a74946e89a48ceb5334efb..5eeb1c5d086ebff6d98585fabb2f6b7328664dc7 100644
--- a/Core/Samples/inc/ICompositeSample.h
+++ b/Core/Samples/inc/ICompositeSample.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ ICompositeSample : public ISample
 {
- public:
+public:
     ICompositeSample() {}
     virtual ~ICompositeSample() {}
 
@@ -61,7 +61,7 @@ class BA_CORE_API_ ICompositeSample : public ISample
     //! Creates general iterator to walk through tree of composite children.
     class ICompositeIterator createIterator();
 
- private:
+private:
     //! List of registered children.
     std::list<ISample*> m_samples;
 };
diff --git a/Core/Samples/inc/IDecoration.h b/Core/Samples/inc/IDecoration.h
index fef54fe9a20aba4f5a95b6f87baf29624cb96ad2..1eada6501ce984db4db9b97f8c5bc04222968356 100644
--- a/Core/Samples/inc/IDecoration.h
+++ b/Core/Samples/inc/IDecoration.h
@@ -28,7 +28,7 @@ class IInterferenceFunction;
 
 class BA_CORE_API_ IDecoration : public ICompositeSample
 {
- public:
+public:
     IDecoration() : m_total_particle_surface_density(1.0) {}
     virtual ~IDecoration() {}
 
@@ -61,7 +61,7 @@ class BA_CORE_API_ IDecoration : public ICompositeSample
     void setTotalParticleSurfaceDensity(double surface_density)
     { m_total_particle_surface_density = surface_density; }
 
- private:
+private:
     ///< To guarantee that fractions sum up to 1
     double m_total_particle_surface_density;
 };
diff --git a/Core/Samples/inc/IDispersalState.h b/Core/Samples/inc/IDispersalState.h
index 50a790a787f6907202fa1fe4f3c605c365568ca4..6c9494d0f97267546c97476f5509baf15fda6438 100644
--- a/Core/Samples/inc/IDispersalState.h
+++ b/Core/Samples/inc/IDispersalState.h
@@ -20,7 +20,7 @@
 
 class IDispersalState
 {
- public:
+public:
     virtual ~IDispersalState() {}
 };
 
diff --git a/Core/Samples/inc/IInterferenceFunction.h b/Core/Samples/inc/IInterferenceFunction.h
index aec751ba1693a0d6ea2d84cf8a30426d361c3273..abf94eafd820264a986c1089ad165060fa4a1cfa 100644
--- a/Core/Samples/inc/IInterferenceFunction.h
+++ b/Core/Samples/inc/IInterferenceFunction.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ IInterferenceFunction : public ISample
 {
- public:
+public:
     virtual ~IInterferenceFunction() {}
 
     //! Evaluates the interference function for a given wavevector transfer
diff --git a/Core/Samples/inc/IRoughness.h b/Core/Samples/inc/IRoughness.h
index 7a026584d47bb547fa4c6a6e2d2a0e0621626c13..8fde31aa6a9eea770ca8d382a1cfd335078965fb 100644
--- a/Core/Samples/inc/IRoughness.h
+++ b/Core/Samples/inc/IRoughness.h
@@ -22,7 +22,7 @@
 
 class BA_CORE_API_ IRoughness : public ISample
 {
- public:
+public:
     IRoughness() {}
     virtual ~IRoughness() {}
 //    virtual IRoughness *clone() const
diff --git a/Core/Samples/inc/ISample.h b/Core/Samples/inc/ISample.h
index da9a540fc4a324f7b9d294893e06fb3d37adbb0a..946a7c7909048f92afe2680ed8717004b7b3cdf5 100644
--- a/Core/Samples/inc/ISample.h
+++ b/Core/Samples/inc/ISample.h
@@ -27,7 +27,7 @@ class DWBASimulation;
 
 class BA_CORE_API_ ISample : public ICloneable, public IParameterized
 {
- public:
+public:
     ISample() { setName("ISample"); }
     virtual ~ISample() {}
 
@@ -58,7 +58,7 @@ class BA_CORE_API_ ISample : public ICloneable, public IParameterized
 
     bool containsMagneticMaterial() const;
 
- protected:
+protected:
     virtual void print(std::ostream& ostr) const;
 };
 
diff --git a/Core/Samples/inc/ISelectionRule.h b/Core/Samples/inc/ISelectionRule.h
index 193b87842fe3625c4a75dd413ca757c56563815a..683262726df6d1573cfb37a4187e8c1d9efbf07f 100644
--- a/Core/Samples/inc/ISelectionRule.h
+++ b/Core/Samples/inc/ISelectionRule.h
@@ -24,7 +24,7 @@ typedef Geometry::BasicVector3D<int> IndexVector3D;
 
 class ISelectionRule
 {
- public:
+public:
     virtual ~ISelectionRule() {}
 
     virtual ISelectionRule *clone() const=0;
@@ -36,14 +36,14 @@ class ISelectionRule
 
 class SimpleSelectionRule : public ISelectionRule
 {
- public:
+public:
     SimpleSelectionRule(int a, int b, int c, int modulus);
     virtual ~SimpleSelectionRule() {}
 
     virtual SimpleSelectionRule *clone() const;
 
     virtual bool coordinateSelected(const IndexVector3D& coordinate) const;
- private:
+private:
     int m_a, m_b, m_c;
     int m_mod;
 };
diff --git a/Core/Samples/inc/InterferenceFunction1DParaCrystal.h b/Core/Samples/inc/InterferenceFunction1DParaCrystal.h
index 39cd10cc303f44c9107f66cd18b8888d5331e14b..fe3abf840e1bfc4925a0163d4a4cd674136dc752 100644
--- a/Core/Samples/inc/InterferenceFunction1DParaCrystal.h
+++ b/Core/Samples/inc/InterferenceFunction1DParaCrystal.h
@@ -20,7 +20,7 @@
 
 class BA_CORE_API_ InterferenceFunction1DParaCrystal : public IInterferenceFunction
 {
- public:
+public:
     InterferenceFunction1DParaCrystal(
         double peak_distance, double width, double corr_length=0.0);
     virtual ~InterferenceFunction1DParaCrystal() {}
@@ -40,14 +40,14 @@ class BA_CORE_API_ InterferenceFunction1DParaCrystal : public IInterferenceFunct
     //TODO: replace these with strategy pattern for different algorithms
     complex_t FTGaussianCorrLength(double qpar) const;
 
- protected:
+protected:
     double m_peak_distance;
     double m_width;
     double m_corr_length;
     bool m_use_corr_length;
     double m_kappa;
 
- private:
+private:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 };
diff --git a/Core/Samples/inc/InterferenceFunction2DLattice.h b/Core/Samples/inc/InterferenceFunction2DLattice.h
index 53fed285b777556124be866fd5293c458e81565a..84a47d158d181d2d7f68f3a7ef1c81da7df7a9b3 100644
--- a/Core/Samples/inc/InterferenceFunction2DLattice.h
+++ b/Core/Samples/inc/InterferenceFunction2DLattice.h
@@ -24,7 +24,7 @@
 
 class BA_CORE_API_ InterferenceFunction2DLattice : public IInterferenceFunction
 {
- public:
+public:
     InterferenceFunction2DLattice(const Lattice2DIFParameters& lattice_params);
     virtual ~InterferenceFunction2DLattice();
 
@@ -37,7 +37,7 @@ class BA_CORE_API_ InterferenceFunction2DLattice : public IInterferenceFunction
     void setProbabilityDistribution(const IFTDistribution2D& pdf);
 
     virtual double evaluate(const cvector_t& q) const;
- protected:
+protected:
     //! Returns interference from a single reciprocal lattice vector
     double interferenceAtOneRecLatticePoint(double qx, double qy) const;
 
@@ -53,7 +53,7 @@ class BA_CORE_API_ InterferenceFunction2DLattice : public IInterferenceFunction
     Lattice2DIFParameters m_lattice_params;
     IFTDistribution2D *mp_pdf;
     static const int nmax = 20; //!< maximum value for qx*Lambdax and qy*lambday
- private:
+private:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 
diff --git a/Core/Samples/inc/InterferenceFunction2DParaCrystal.h b/Core/Samples/inc/InterferenceFunction2DParaCrystal.h
index 21c00aaa6cdce251c35ab4068e67a2f42ea6f8a8..1372433ea0d121b50038dedd3553331a29e15e39 100644
--- a/Core/Samples/inc/InterferenceFunction2DParaCrystal.h
+++ b/Core/Samples/inc/InterferenceFunction2DParaCrystal.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ InterferenceFunction2DParaCrystal : public IInterferenceFunction
 {
- public:
+public:
     InterferenceFunction2DParaCrystal(double length_1, double length_2, double alpha_lattice, double xi=0.0, double corr_length=0.0);
     virtual ~InterferenceFunction2DParaCrystal();
 
@@ -50,7 +50,7 @@ class BA_CORE_API_ InterferenceFunction2DParaCrystal : public IInterferenceFunct
     //! Adds parameters from local pool to external pool and call recursion over direct children
     virtual std::string addParametersToExternalPool(std::string path, ParameterPool *external_pool, int copy_number=-1) const;
 
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 
@@ -63,7 +63,7 @@ class BA_CORE_API_ InterferenceFunction2DParaCrystal : public IInterferenceFunct
     double m_corr_length;
     bool m_use_corr_length;
     double m_domain_sizes[2];
- private:
+private:
 
     //! Returns interference function for fixed rotation xi
     double interferenceForXi(double xi, void *params) const;
diff --git a/Core/Samples/inc/InterferenceFunctionNone.h b/Core/Samples/inc/InterferenceFunctionNone.h
index ab0840e93d59883b2b336970044975b712e785d4..6b1d2a7f8d32d6d422388dc10d53fb6b20cc10d7 100644
--- a/Core/Samples/inc/InterferenceFunctionNone.h
+++ b/Core/Samples/inc/InterferenceFunctionNone.h
@@ -22,7 +22,7 @@
 
 class InterferenceFunctionNone : public IInterferenceFunction
 {
- public:
+public:
     InterferenceFunctionNone() { setName("InterferenceFunctionNone"); }
     virtual ~InterferenceFunctionNone() {}
     virtual InterferenceFunctionNone *clone() const
diff --git a/Core/Samples/inc/Lattice.h b/Core/Samples/inc/Lattice.h
index 65e0fe17a5719e8b73b20f0f11e74d40feb57fe7..8cc36eef78f1345cb674796391880d803e5ad1e4 100644
--- a/Core/Samples/inc/Lattice.h
+++ b/Core/Samples/inc/Lattice.h
@@ -27,7 +27,7 @@
 
 class BA_CORE_API_ Lattice
 {
- public:
+public:
     Lattice();
     Lattice(const kvector_t& a1, const kvector_t& a2, const kvector_t& a3);
     Lattice(const Lattice& lattice);
@@ -89,7 +89,7 @@ class BA_CORE_API_ Lattice
     static Lattice createTrigonalLattice(double a, double c);
 
     const KVectorContainer& getKVectorContainer() const { return m_kvector_container; }
- private:
+private:
     Lattice& operator=(const Lattice& lattice);
 //    std::vector<kvector_t> getVectorsWithinRadius(const kvector_t& input_vector,
 //            const IndexVector3D& nearest_coords, double radius,
diff --git a/Core/Samples/inc/Lattice2DIFParameters.h b/Core/Samples/inc/Lattice2DIFParameters.h
index 69d8fce0f800fc57d211fc5472e1e7d898698fca..deddbfa5a83a1843e0f50a85d90fcba8417ed16e 100644
--- a/Core/Samples/inc/Lattice2DIFParameters.h
+++ b/Core/Samples/inc/Lattice2DIFParameters.h
@@ -20,7 +20,7 @@
 
 class Lattice2DIFParameters
 {
- public:
+public:
     Lattice2DIFParameters() : m_length_1(0), m_length_2(0), m_angle(0),
         m_xi(0), m_domain_size_1(0), m_domain_size_2(0),
         m_corr_length_1(0), m_corr_length_2(0) { }
diff --git a/Core/Samples/inc/LatticeBasis.h b/Core/Samples/inc/LatticeBasis.h
index 1f1c860fc0376f728858f88d9cc3a083002cdfb9..6d0419f94f67bc56b3d3c674429220e3625a9275 100644
--- a/Core/Samples/inc/LatticeBasis.h
+++ b/Core/Samples/inc/LatticeBasis.h
@@ -33,13 +33,17 @@ public:
     virtual LatticeBasis *cloneInvertB() const;
 
     //! Calls the ISampleVisitor's visit method
-    virtual void accept(ISampleVisitor *p_visitor) const { p_visitor->visit(this); }
+    virtual void accept(ISampleVisitor *p_visitor) const {
+        p_visitor->visit(this);
+    }
 
-    void addParticle(const Particle& particle, std::vector<kvector_t > positions);
+    void addParticle(const Particle& particle,
+                     std::vector<kvector_t > positions);
 
     virtual void setAmbientMaterial(const IMaterial *p_material);
 
-    virtual IFormFactor* createFormFactor() const;
+    virtual IFormFactor* createFormFactor(
+            complex_t wavevector_scattering_factor) const;
 
     //! Returns number of different particles
     size_t getNbrParticles() const {return m_particles.size(); }
@@ -48,24 +52,29 @@ public:
     size_t getNbrPositionsForParticle(size_t index) const
     { return m_positions_vector[check_index(index)].size(); }
 
-    //! Returns position of element with given index
-//    kvector_t getPosition(size_t index) const { return m_positions[check_index(index)]; }
-
     //! Returns particle with given index
-    const Particle *getParticle(size_t index) const { return m_particles[check_index(index)]; }
+    const Particle *getParticle(size_t index) const {
+        return m_particles[check_index(index)];
+    }
 
     std::vector<kvector_t> getParticlePositions(size_t index) const
     { return m_positions_vector[check_index(index)]; }
 
-    //! Creates vector of size/shape distributed particles corresponding to the particle with index i
+    //! Creates vector of size/shape distributed particles corresponding to the
+    //! particle with index i
     std::vector<DiffuseParticleInfo *> createDiffuseParticleInfos() const;
 
 private:
     //! Checks index
-    inline size_t check_index(size_t index) const { return index < m_positions_vector.size() ? index : throw OutOfBoundsException("LatticeBasis::check_index() -> Index is out of bounds"); }
+    inline size_t check_index(size_t index) const {
+        return index < m_positions_vector.size()
+                ? index
+                : throw OutOfBoundsException("LatticeBasis::check_index()"
+                        "-> Index is out of bounds"); }
 
     //! For internal use in cloneInvertB():
-    void addParticlePointer(Particle *p_particle, std::vector<kvector_t > positions);
+    void addParticlePointer(Particle *p_particle,
+            std::vector<kvector_t > positions);
 
     std::vector<Particle *> m_particles;
     std::vector<std::vector<kvector_t> > m_positions_vector;
diff --git a/Core/Samples/inc/Layer.h b/Core/Samples/inc/Layer.h
index 342d47765ef394f860ee60e86f940ae4dab9243c..1b84913516b96ea9c9ef3eda41af8456b19337ed 100644
--- a/Core/Samples/inc/Layer.h
+++ b/Core/Samples/inc/Layer.h
@@ -27,7 +27,7 @@
 
 class BA_CORE_API_ Layer : public ICompositeSample
 {
- public:
+public:
     //! Constructs empty layer.
     Layer();
 
@@ -80,7 +80,7 @@ class BA_CORE_API_ Layer : public ICompositeSample
 
     virtual double getTotalParticleSurfaceDensity() const;
 
- protected:
+protected:
     Layer(const Layer& other);
 
     void init_parameters();
diff --git a/Core/Samples/inc/LayerInterface.h b/Core/Samples/inc/LayerInterface.h
index 01b0332754d69a4a181b0a1623805e293141d91e..76a240a5e09fc3b8fb9531f08d36c474fcf4fb33 100644
--- a/Core/Samples/inc/LayerInterface.h
+++ b/Core/Samples/inc/LayerInterface.h
@@ -25,7 +25,7 @@ class Layer;
 
 class LayerInterface : public ICompositeSample
 {
- public:
+public:
     virtual ~LayerInterface();
 
     //! calls the ISampleVisitor's visit method
@@ -65,10 +65,10 @@ class LayerInterface : public ICompositeSample
     //! Returns bottom layer.
     const Layer *getLayerBottom() const { return m_LayerBottom; }
 
- protected:
+protected:
     void print(std::ostream& ostr) const;
 
- private:
+private:
     LayerInterface();
 
     LayerRoughness *m_roughness;   //!< roughness of the interface
diff --git a/Core/Samples/inc/LayerRoughness.h b/Core/Samples/inc/LayerRoughness.h
index 793d26c74b7768fd08c1b40721bbf98adfe3cf7f..5927e52db7b6635ecf0c5e484036759830bd49bf 100644
--- a/Core/Samples/inc/LayerRoughness.h
+++ b/Core/Samples/inc/LayerRoughness.h
@@ -29,7 +29,7 @@
 
 class BA_CORE_API_ LayerRoughness : public IRoughness
 {
- public:
+public:
     LayerRoughness();
     LayerRoughness(double sigma, double hurstParameter, double latteralCorrLength);
 
@@ -62,7 +62,7 @@ class BA_CORE_API_ LayerRoughness : public IRoughness
     friend std::ostream& operator<<(std::ostream& ostr, /*const*/ LayerRoughness& m)
     { m.print(ostr); return ostr; }
 
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
 
diff --git a/Core/Samples/inc/MaterialManager.h b/Core/Samples/inc/MaterialManager.h
index 4fa21f5fd82badf1f90f129446b56524f4b0deb9..ff18d13baeeff8b83385f6ad524ae2bef56fdb26 100644
--- a/Core/Samples/inc/MaterialManager.h
+++ b/Core/Samples/inc/MaterialManager.h
@@ -30,7 +30,7 @@
 //!
 class BA_CORE_API_ MaterialManager: public ISingleton<MaterialManager>
 {
- public:
+public:
     typedef std::map<std::string, IMaterial*> materials_t;
     typedef materials_t::iterator iterator;
     typedef materials_t::const_iterator const_iterator;
@@ -101,7 +101,7 @@ class BA_CORE_API_ MaterialManager: public ISingleton<MaterialManager>
     //! delete material
     bool deleteMaterial(const std::string &name);
 
- protected:
+protected:
     MaterialManager(){}
     friend class ISingleton<MaterialManager >;
 
@@ -113,7 +113,7 @@ class BA_CORE_API_ MaterialManager: public ISingleton<MaterialManager>
 
     materials_t m_materials; //!< our database
 
- private:
+private:
     const IMaterial *this_getMaterial(const std::string& name);
     const IMaterial *this_getHomogeneousMaterial(
         const std::string& name, const complex_t& refractive_index);
diff --git a/Core/Samples/inc/MesoCrystal.h b/Core/Samples/inc/MesoCrystal.h
index 1435bf0766f58509bd3c3fb4c2e344f6ec9077b2..43c2ca56ccf4cd64dc3d7d4532ddaeacfc99aeed 100644
--- a/Core/Samples/inc/MesoCrystal.h
+++ b/Core/Samples/inc/MesoCrystal.h
@@ -24,9 +24,11 @@
 
 class BA_CORE_API_ MesoCrystal : public Particle
 {
- public:
-    MesoCrystal(IClusteredParticles *p_particle_structure, IFormFactor *p_form_factor);
-    MesoCrystal(const IClusteredParticles& particle_structure, IFormFactor& form_factor);
+public:
+    MesoCrystal(IClusteredParticles *p_particle_structure,
+            IFormFactor *p_form_factor);
+    MesoCrystal(const IClusteredParticles& particle_structure,
+            IFormFactor& form_factor);
 
     virtual ~MesoCrystal();
     virtual MesoCrystal *clone() const;
@@ -35,35 +37,34 @@ class BA_CORE_API_ MesoCrystal : public Particle
     virtual MesoCrystal *cloneInvertB() const;
 
     //! Calls the ISampleVisitor's visit method
-    virtual void accept(ISampleVisitor *p_visitor) const { p_visitor->visit(this); }
+    virtual void accept(ISampleVisitor *p_visitor) const {
+        p_visitor->visit(this);
+    }
 
     virtual void setAmbientMaterial(const IMaterial *p_material)
     {
         mp_particle_structure->setAmbientMaterial(p_material);
     }
 
-    virtual IFormFactor* createFormFactor() const
-    {
-        return mp_particle_structure->createTotalFormFactor(
-                *mp_meso_form_factor, mp_ambient_material);
-    }
+    virtual IFormFactor* createFormFactor(
+            complex_t wavevector_scattering_factor) const;
 
-    virtual void setSimpleFormFactor(IFormFactor* p_form_factor)
-    {
-        if (p_form_factor != mp_meso_form_factor) {
-            delete mp_meso_form_factor;
-            mp_meso_form_factor = p_form_factor;
-        }
-    }
+    virtual void setSimpleFormFactor(IFormFactor* p_form_factor);
 
-    virtual const IFormFactor *getSimpleFormFactor() const { return mp_meso_form_factor;}
+    virtual const IFormFactor *getSimpleFormFactor() const {
+        return mp_meso_form_factor;
+    }
 
-    //! @brief get the internal structure, which is in principle unbounded in space (eg.  an infinite crystal)
-    const IClusteredParticles *getClusteredParticles() const {return mp_particle_structure; }
+    //! @brief get the internal structure, which is in principle unbounded in
+    //! space (eg.  an infinite crystal)
+    const IClusteredParticles *getClusteredParticles() const {
+        return mp_particle_structure;
+    }
 
-    virtual std::vector<DiffuseParticleInfo *> *createDiffuseParticleInfo(const ParticleInfo& parent_info) const;
+    virtual std::vector<DiffuseParticleInfo *> *createDiffuseParticleInfo(
+            const ParticleInfo& parent_info) const;
 
- private:
+private:
     IClusteredParticles *mp_particle_structure;
     IFormFactor *mp_meso_form_factor;
 };
diff --git a/Core/Samples/inc/MultiLayer.h b/Core/Samples/inc/MultiLayer.h
index 8b348265f12bcb2f17c293b26758eb81bfb9a773..357cffbbd1ebd1b215e2a1783c3a98f69a808451 100644
--- a/Core/Samples/inc/MultiLayer.h
+++ b/Core/Samples/inc/MultiLayer.h
@@ -37,7 +37,7 @@
 
 class BA_CORE_API_ MultiLayer : public ICompositeSample
 {
- public:
+public:
     MultiLayer();
     ~MultiLayer();
 
@@ -119,13 +119,13 @@ class BA_CORE_API_ MultiLayer : public ICompositeSample
     //! ISimulation if needed
     virtual MultiLayerDWBASimulation *createDWBASimulation() const;
 
- protected:
+protected:
     //! Registers some class members for later access via parameter pool
     virtual void init_parameters();
     //! Prints class
     void print(std::ostream& ostr) const;
 
- private:
+private:
     //! Adds the layer with simultaneous registration in parent class
     void addAndRegisterLayer(Layer *child)
     {
diff --git a/Core/Samples/inc/Particle.h b/Core/Samples/inc/Particle.h
index d3134181f3e8b9abe7bf1f2da119d09eaaf8c01d..0228850b37da14ad2623442e01015129a8e89db0 100644
--- a/Core/Samples/inc/Particle.h
+++ b/Core/Samples/inc/Particle.h
@@ -17,8 +17,8 @@
 #define PARTICLE_H
 
 #include "ICompositeSample.h"
-#include "IFormFactor.h"
-#include "FormFactorDecoratorRefractiveIndex.h"
+#include "FormFactorDecoratorMaterial.h"
+#include "FormFactorDecoratorTransformation.h"
 #include "HomogeneousMaterial.h"
 
 class ParticleInfo;
@@ -28,10 +28,12 @@ class DiffuseParticleInfo;
 
 class BA_CORE_API_ Particle : public ICompositeSample
 {
- public:
+public:
     Particle();
     Particle(const IMaterial* p_material, IFormFactor* p_form_factor = 0);
     Particle(const IMaterial* p_material, const IFormFactor& form_factor);
+    Particle(const IMaterial* p_material, const IFormFactor& form_factor,
+            const Geometry::PTransform3D &transform);
     virtual ~Particle();
     virtual Particle *clone() const;
 
@@ -48,29 +50,11 @@ class BA_CORE_API_ Particle : public ICompositeSample
         mp_ambient_material = p_material;
     }
 
-    virtual IFormFactor* createFormFactor() const
-    {
-        if(!mp_form_factor) return 0;
-        FormFactorDecoratorRefractiveIndex *p_ff =
-                new FormFactorDecoratorRefractiveIndex(
-                mp_form_factor->clone(), getRefractiveIndex());
-        p_ff->setAmbientMaterial(mp_ambient_material);
-        return p_ff;
-    }
-
-    //! Sets the form factor of the particle (not including scattering factor
-    //! from refractive index)
-    virtual void setSimpleFormFactor(IFormFactor* p_form_factor)
-    {
-        if (!p_form_factor) return;
-
-        if (p_form_factor != mp_form_factor) {
-            deregisterChild(mp_form_factor);
-            delete mp_form_factor;
-            mp_form_factor = p_form_factor;
-            registerChild(mp_form_factor);
-        }
-    }
+    //! Create a form factor which includes the particle's shape,
+    //! material, ambient material, an optional transformation and an extra
+    //! scattering factor
+    virtual IFormFactor* createFormFactor(
+            complex_t wavevector_scattering_factor) const;
 
     //! Sets _material_ and _thickness_.
     virtual void setMaterial(const IMaterial* p_material) {
@@ -88,31 +72,40 @@ class BA_CORE_API_ Particle : public ICompositeSample
                             : complex_t(0,0));
     }
 
-    //! Returns formfactor of the particle (not including scattering factor from
-    //! refractive index)
+    //! Returns transformation.
+    const Geometry::PTransform3D getPTransform3D() const
+    { return mP_transform; }
+
+    //! Sets transformation.
+    virtual void setTransform(const Geometry::PTransform3D& transform)
+    { mP_transform = transform; }
+
+    //! Returns form factor of the particle originating from its shape only
     virtual const IFormFactor *getSimpleFormFactor() const {
         return mp_form_factor;
     }
 
+    //! Sets the form factor of the particle (not including scattering factor
+    //! from refractive index)
+    virtual void setSimpleFormFactor(IFormFactor* p_form_factor);
+
     //! Creates list of contained particles for diffuse calculations
     virtual std::vector<DiffuseParticleInfo *> *createDiffuseParticleInfo(
-            const ParticleInfo& /*parent_info*/) const {
-        return 0;
-    }
+            const ParticleInfo& parent_info) const;
 
-    virtual bool hasDistributedFormFactor() const
-    {
-        return ( !mp_form_factor ? false
-                                 : mp_form_factor->isDistributedFormFactor() );
-    }
+    //! Indicates whether the particle consists of an assembly of different
+    //! form factors according to a certain distribution
+    virtual bool hasDistributedFormFactor() const;
 
     virtual std::vector<ParticleInfo *> createDistributedParticles(
             size_t samples_per_particle, double factor) const;
 
- protected:
+protected:
+    IFormFactor *createTransformedFormFactor() const;
     const IMaterial* mp_material;
     const IMaterial* mp_ambient_material;
     IFormFactor* mp_form_factor;
+    Geometry::PTransform3D mP_transform;
     //!< pointer to the form factor
 };
 
diff --git a/Core/Samples/inc/ParticleBuilder.h b/Core/Samples/inc/ParticleBuilder.h
index 0e3d73f069f3298e43ebf20ea059fc70e848ffd6..7a10fc8de41e452c368e2a076dc2fb5512383995 100644
--- a/Core/Samples/inc/ParticleBuilder.h
+++ b/Core/Samples/inc/ParticleBuilder.h
@@ -28,7 +28,7 @@
 
 class BA_CORE_API_ ParticleBuilder
 {
- public:
+public:
     ParticleBuilder();
     virtual ~ParticleBuilder();
 
@@ -42,7 +42,7 @@ class BA_CORE_API_ ParticleBuilder
     //! plant particles in given decoration
     void plantParticles(ParticleDecoration& decor);
 
- private:
+private:
     Particle *m_prototype; //!< prototype of the particle, all particles will be cloned from it
     std::string m_parameter_name; //!< name of parameter to variate
     StochasticParameter<double > *m_parameter;
diff --git a/Core/Samples/inc/ParticleCoreShell.h b/Core/Samples/inc/ParticleCoreShell.h
index 643510b72bc62d07222bd2ef0fad353de1d0a3f1..eb15497bc6f0e0fa9f4f3c3c4d8e635d8530d08d 100644
--- a/Core/Samples/inc/ParticleCoreShell.h
+++ b/Core/Samples/inc/ParticleCoreShell.h
@@ -38,26 +38,14 @@ public:
 
     //! Sets the refractive index of the ambient material (which influences
     //! its scattering power)
-    virtual void setAmbientMaterial(const IMaterial *p_material)
-    {
-        mp_ambient_material = p_material;
-        mp_shell->setAmbientMaterial(p_material);
-        mp_core->setAmbientMaterial(p_material);
-    }
+    virtual void setAmbientMaterial(const IMaterial *p_material);
 
-    virtual IFormFactor* createFormFactor() const;
+    virtual IFormFactor* createFormFactor(
+            complex_t wavevector_scattering_factor) const;
 
     //! Sets the formfactor of the particle (not including scattering factor
     //! from refractive index)
-    virtual void setSimpleFormFactor(IFormFactor* p_form_factor)
-    {
-        if (p_form_factor != mp_form_factor) {
-            deregisterChild(mp_form_factor);
-            delete mp_form_factor;
-            mp_form_factor = p_form_factor;
-            registerChild(mp_form_factor);
-        }
-    }
+    virtual void setSimpleFormFactor(IFormFactor* p_form_factor);
 
     //! Returns formfactor of the particle (not including scattering factor
     //! from refractive index)
diff --git a/Core/Samples/inc/ParticleDecoration.h b/Core/Samples/inc/ParticleDecoration.h
index f35d5037eb46bed72bf135f3d63a8aaf7a3e003d..ec3eca80a9d4b22fedd5368933bc044533023097 100644
--- a/Core/Samples/inc/ParticleDecoration.h
+++ b/Core/Samples/inc/ParticleDecoration.h
@@ -25,7 +25,7 @@
 
 class BA_CORE_API_ ParticleDecoration : public IDecoration
 {
- public:
+public:
     ParticleDecoration()
         : m_total_abundance(0.0)
     {
@@ -105,7 +105,7 @@ class BA_CORE_API_ ParticleDecoration : public IDecoration
     //! Returns interference function with index
     const IInterferenceFunction* getInterferenceFunction(size_t index) const;
 
- private:
+private:
     //! Adds particle information with simultaneous registration in parent class.
     void addAndRegisterParticleInfo(ParticleInfo *child);
 
diff --git a/Core/Samples/inc/ParticleInfo.h b/Core/Samples/inc/ParticleInfo.h
index 2a51fdc4dca9e17b02efb2c6e3fc498b5ae4dee4..2c6b0edfe6115b36fb971839d722d8342bc263aa 100644
--- a/Core/Samples/inc/ParticleInfo.h
+++ b/Core/Samples/inc/ParticleInfo.h
@@ -18,19 +18,12 @@
 
 #include "ICompositeSample.h"
 #include "Particle.h"
-#include "ITransform3D.h"
 
 //! Holds additional information about particle (used in ParticleDecoration).
 
 class BA_CORE_API_ ParticleInfo : public ICompositeSample
 {
- public:
-    ParticleInfo(Particle *p_particle,
-                 const Geometry::PTransform3D& transform,
-                 double depth=0, double abundance=0);
-    ParticleInfo(const Particle& p_particle,
-                 const Geometry::PTransform3D& transform,
-                 double depth=0, double abundance=0);
+public:
     ParticleInfo(Particle *p_particle,
                  double depth=0, double abundance=0);
     ParticleInfo(const Particle& p_particle,
@@ -41,14 +34,14 @@ class BA_CORE_API_ ParticleInfo : public ICompositeSample
     virtual ParticleInfo *clone() const
     {
         return new ParticleInfo(
-            mp_particle->clone(), mP_transform, m_depth, m_abundance);
+            mp_particle->clone(), m_depth, m_abundance);
     }
 
     //! Returns a clone with inverted magnetic fields
     virtual ParticleInfo *cloneInvertB() const
     {
         return new ParticleInfo(
-            mp_particle->cloneInvertB(), mP_transform, m_depth, m_abundance);
+            mp_particle->cloneInvertB(), m_depth, m_abundance);
     }
 
     //! calls the ISampleVisitor's visit method
@@ -57,14 +50,6 @@ class BA_CORE_API_ ParticleInfo : public ICompositeSample
     //! Returns particle.
     const Particle *getParticle() const { return mp_particle; }
 
-    //! Returns transformation.
-    const Geometry::PTransform3D getPTransform3D() const
-    { return mP_transform; }
-
-    //! Sets transformation.
-    void setTransform(const Geometry::PTransform3D& transform)
-    { mP_transform = transform; }
-
     //! Returns depth.
     double getDepth() const { return m_depth; }
 
@@ -77,13 +62,12 @@ class BA_CORE_API_ ParticleInfo : public ICompositeSample
     //! Sets abundance.
     void setAbundance(double abundance) { m_abundance = abundance; }
 
- protected:
+protected:
     virtual void init_parameters();
 
     virtual void print(std::ostream& ostr) const;
 
     Particle *mp_particle;
-    Geometry::PTransform3D mP_transform;
     double m_depth;
     double m_abundance;
 };
diff --git a/Core/Samples/inc/PositionParticleInfo.h b/Core/Samples/inc/PositionParticleInfo.h
index a291812a5019f78ccda20efd6687490cf128ebe3..24822bebd2fc2032fd6e5dc84dce7724ddc97da5 100644
--- a/Core/Samples/inc/PositionParticleInfo.h
+++ b/Core/Samples/inc/PositionParticleInfo.h
@@ -25,15 +25,7 @@
 //!
 class BA_CORE_API_ PositionParticleInfo : public ParticleInfo
 {
- public:
-    PositionParticleInfo(
-        Particle *p_particle, const Geometry::PTransform3D& transform,
-        kvector_t position, double abundance=0);
-
-    PositionParticleInfo(
-        const Particle& particle, const Geometry::PTransform3D& transform,
-        kvector_t position, double abundance=0);
-
+public:
     PositionParticleInfo(
         Particle *p_particle, kvector_t position, double abundance=0);
 
@@ -57,7 +49,7 @@ class BA_CORE_API_ PositionParticleInfo : public ParticleInfo
     //! Sets particle position, including depth.
     void setPosition(kvector_t position);
 
- protected:
+protected:
     PositionParticleInfo& operator=(const PositionParticleInfo& right);
     PositionParticleInfo(const PositionParticleInfo& source);
 
diff --git a/Core/Samples/src/Crystal.cpp b/Core/Samples/src/Crystal.cpp
index 2df30de9d08fa5702b767c0379a8934dddaf7661..33819d2bd3f03637ab3c89bd29d7e1d52360075c 100644
--- a/Core/Samples/src/Crystal.cpp
+++ b/Core/Samples/src/Crystal.cpp
@@ -51,11 +51,12 @@ Crystal* Crystal::cloneInvertB() const
 
 IFormFactor* Crystal::createTotalFormFactor(
         const IFormFactor& meso_crystal_form_factor,
-        const IMaterial *p_ambient_material) const
+        const IMaterial *p_ambient_material,
+        complex_t wavevector_scattering_factor) const
 {
     IFormFactor *p_ff_crystal =
         new FormFactorCrystal(*this, meso_crystal_form_factor,
-                p_ambient_material);
+                p_ambient_material, wavevector_scattering_factor);
     if (m_dw_factor>0.0) {
         return new FormFactorDecoratorDebyeWaller(p_ff_crystal, m_dw_factor);
     }
@@ -65,7 +66,8 @@ IFormFactor* Crystal::createTotalFormFactor(
 std::vector<DiffuseParticleInfo*>* Crystal::createDiffuseParticleInfo(
         const ParticleInfo& parent_info) const
 {
-    std::vector<DiffuseParticleInfo *> *p_result = new std::vector<DiffuseParticleInfo *>(
+    std::vector<DiffuseParticleInfo *> *p_result =
+            new std::vector<DiffuseParticleInfo *>(
             mp_lattice_basis->createDiffuseParticleInfos());
     if (p_result->empty()) return p_result;
 
@@ -81,7 +83,6 @@ std::vector<DiffuseParticleInfo*>* Crystal::createDiffuseParticleInfo(
 
     for (size_t i=0; i<p_result->size(); ++i) {
         DiffuseParticleInfo *p_info = (*p_result)[i];
-        p_info->setTransform( parent_info.getPTransform3D() );
         p_info->setDepth(parent_depth);
         p_info->setNumberPerMeso(nbr_unit_cells*p_info->getNumberPerMeso());
         p_info->setHeightRange(parent_height);
diff --git a/Core/Samples/src/IMaterial.cpp b/Core/Samples/src/IMaterial.cpp
index 8dc89c89b70faebd7b30480cd3b75180915edc02..f14c36f5761f9113b2f684d11439fd2b1c10e115 100644
--- a/Core/Samples/src/IMaterial.cpp
+++ b/Core/Samples/src/IMaterial.cpp
@@ -15,14 +15,9 @@
 
 #include "IMaterial.h"
 
-#ifndef GCCXML_SKIP_THIS
 Eigen::Matrix2cd IMaterial::getScatteringMatrix(double k_mag2) const
 {
     (void)k_mag2;
     return Eigen::Matrix2cd::Identity();
 }
-#endif
-
-
-
 
diff --git a/Core/Samples/src/LatticeBasis.cpp b/Core/Samples/src/LatticeBasis.cpp
index 9f8bf8f8ca5b224c62600c87a65fe9fd6e983a53..6f1c289edd124e369ad527a4b957419ca1ea9d37 100644
--- a/Core/Samples/src/LatticeBasis.cpp
+++ b/Core/Samples/src/LatticeBasis.cpp
@@ -70,7 +70,8 @@ LatticeBasis* LatticeBasis::cloneInvertB() const
     return p_new;
 }
 
-void LatticeBasis::addParticle(const Particle& particle, std::vector<kvector_t > positions)
+void LatticeBasis::addParticle(const Particle& particle,
+        std::vector<kvector_t > positions)
 {
     Particle *np = particle.clone();
     registerChild(np);
@@ -86,20 +87,24 @@ void LatticeBasis::setAmbientMaterial(const IMaterial *p_material)
     }
 }
 
-IFormFactor* LatticeBasis::createFormFactor() const
+IFormFactor* LatticeBasis::createFormFactor(
+        complex_t wavevector_scattering_factor) const
 {
     FormFactorWeighted *p_ff = new FormFactorWeighted();
     for (size_t index=0; index<m_particles.size(); ++index) {
-        IFormFactor *p_particle_ff = m_particles[index]->createFormFactor();
-        FormFactorDecoratorMultiPositionFactor pos_ff(*p_particle_ff, m_positions_vector[index]);
+        boost::scoped_ptr<IFormFactor> P_particle_ff(
+                m_particles[index]->createFormFactor(
+                                      wavevector_scattering_factor));
+        FormFactorDecoratorMultiPositionFactor pos_ff(*P_particle_ff,
+                m_positions_vector[index]);
         p_ff->addFormFactor(pos_ff);
-        delete p_particle_ff;
     }
     p_ff->setAmbientMaterial(mp_ambient_material);
     return p_ff;
 }
 
-std::vector<DiffuseParticleInfo *> LatticeBasis::createDiffuseParticleInfos() const
+std::vector<DiffuseParticleInfo *>
+LatticeBasis::createDiffuseParticleInfos() const
 {
     std::vector<DiffuseParticleInfo *> result;
     for (size_t index=0; index<getNbrParticles(); ++index) {
@@ -107,7 +112,8 @@ std::vector<DiffuseParticleInfo *> LatticeBasis::createDiffuseParticleInfos() co
         if (p_particle->hasDistributedFormFactor()) {
             DiffuseParticleInfo *p_new_info = new DiffuseParticleInfo(
                     p_particle->clone());
-            p_new_info->setNumberPerMeso((double)getNbrPositionsForParticle(index));
+            p_new_info->setNumberPerMeso(
+                    (double)getNbrPositionsForParticle(index));
             result.push_back(p_new_info);
         }
     }
diff --git a/Core/Samples/src/MesoCrystal.cpp b/Core/Samples/src/MesoCrystal.cpp
index f55e0114dc163c0f81b62f04f824b4b8cfce5d0d..e1e49552981ec40a6ac0badf160a8bf5158cf614 100644
--- a/Core/Samples/src/MesoCrystal.cpp
+++ b/Core/Samples/src/MesoCrystal.cpp
@@ -53,6 +53,22 @@ MesoCrystal* MesoCrystal::cloneInvertB() const
             mp_meso_form_factor->clone());
 }
 
+IFormFactor* MesoCrystal::createFormFactor(
+        complex_t wavevector_scattering_factor) const
+{
+    return mp_particle_structure->createTotalFormFactor(
+            *mp_meso_form_factor, mp_ambient_material,
+            wavevector_scattering_factor);
+}
+
+void MesoCrystal::setSimpleFormFactor(IFormFactor* p_form_factor)
+{
+    if (p_form_factor != mp_meso_form_factor) {
+        delete mp_meso_form_factor;
+        mp_meso_form_factor = p_form_factor;
+    }
+}
+
 std::vector<DiffuseParticleInfo*>* MesoCrystal::createDiffuseParticleInfo(
         const ParticleInfo& parent_info) const
 {
diff --git a/Core/Samples/src/Particle.cpp b/Core/Samples/src/Particle.cpp
index d586e87a7e725b11dc2443708d1dc4c509189db9..dea932a2752f667ccb54ff14cd117e8a72b508d1 100644
--- a/Core/Samples/src/Particle.cpp
+++ b/Core/Samples/src/Particle.cpp
@@ -45,6 +45,17 @@ Particle::Particle(const IMaterial* p_material, const IFormFactor& form_factor)
     if(mp_form_factor) registerChild(mp_form_factor);
 }
 
+Particle::Particle(const IMaterial* p_material, const IFormFactor& form_factor,
+        const Geometry::PTransform3D &transform)
+: mp_material(p_material)
+, mp_ambient_material(0)
+, mp_form_factor(form_factor.clone())
+, mP_transform(transform)
+{
+    setName("Particle");
+    if(mp_form_factor) registerChild(mp_form_factor);
+}
+
 
 Particle::~Particle()
 {
@@ -60,6 +71,8 @@ Particle* Particle::clone() const
     Particle *p_new = new Particle(mp_material, p_form_factor);
     p_new->setAmbientMaterial(mp_ambient_material);
 
+    p_new->setTransform(mP_transform);
+
     p_new->setName(getName());
     return p_new;
 }
@@ -80,10 +93,27 @@ Particle* Particle::cloneInvertB() const
     Particle *p_new = new Particle(p_material, p_form_factor);
     p_new->setAmbientMaterial(p_ambient_material);
 
+    p_new->setTransform(mP_transform);
+
     p_new->setName(getName() + "_inv");
     return p_new;
 }
 
+IFormFactor* Particle::createFormFactor(
+        complex_t wavevector_scattering_factor) const
+{
+    IFormFactor *p_transformed_ff = createTransformedFormFactor();
+    if (!p_transformed_ff) {
+        return 0;
+    }
+    FormFactorDecoratorMaterial *p_ff =
+            new FormFactorDecoratorMaterial(
+                    p_transformed_ff, wavevector_scattering_factor);
+    p_ff->setMaterial(mp_material);
+    p_ff->setAmbientMaterial(mp_ambient_material);
+    return p_ff;
+}
+
 std::vector<ParticleInfo*> Particle::createDistributedParticles(
         size_t samples_per_particle, double factor) const
 {
@@ -107,4 +137,41 @@ std::vector<ParticleInfo*> Particle::createDistributedParticles(
     return result;
 }
 
+void Particle::setSimpleFormFactor(IFormFactor* p_form_factor)
+{
+    if (!p_form_factor) return;
+
+    if (p_form_factor != mp_form_factor) {
+        deregisterChild(mp_form_factor);
+        delete mp_form_factor;
+        mp_form_factor = p_form_factor;
+        registerChild(mp_form_factor);
+    }
+}
+
+std::vector<DiffuseParticleInfo*>* Particle::createDiffuseParticleInfo(
+        const ParticleInfo& parent_info) const
+{
+    (void)parent_info;
+    return 0;
+}
 
+bool Particle::hasDistributedFormFactor() const
+{
+    return ( !mp_form_factor ? false
+                             : mp_form_factor->isDistributedFormFactor() );
+}
+
+IFormFactor* Particle::createTransformedFormFactor() const
+{
+    if(!mp_form_factor) return 0;
+    IFormFactor *p_result;
+    if(mP_transform.get()) {
+        p_result = new FormFactorDecoratorTransformation(
+                mp_form_factor->clone(), mP_transform);
+    }
+    else {
+        p_result = mp_form_factor->clone();
+    }
+    return p_result;
+}
diff --git a/Core/Samples/src/ParticleCoreShell.cpp b/Core/Samples/src/ParticleCoreShell.cpp
index 263963bb018ea2202f913f8eca58299df14303e4..9e5186991d2379a9c2e9872e4e46e970047fc501 100644
--- a/Core/Samples/src/ParticleCoreShell.cpp
+++ b/Core/Samples/src/ParticleCoreShell.cpp
@@ -50,29 +50,43 @@ ParticleCoreShell* ParticleCoreShell::cloneInvertB() const
     return p_new;
 }
 
-IFormFactor *ParticleCoreShell::createFormFactor() const
+void ParticleCoreShell::setAmbientMaterial(const IMaterial* p_material)
+{
+    mp_ambient_material = p_material;
+    mp_shell->setAmbientMaterial(p_material);
+    mp_core->setAmbientMaterial(p_material);
+}
+
+IFormFactor *ParticleCoreShell::createFormFactor(
+        complex_t wavevector_scattering_factor) const
 {
     FormFactorWeighted *p_result = new FormFactorWeighted;
-    FormFactorDecoratorRefractiveIndex ff_shell(mp_shell->
+    FormFactorDecoratorMaterial ff_shell(mp_shell->
             getSimpleFormFactor()->clone(),
-            mp_shell->getRefractiveIndex());
+            wavevector_scattering_factor);
+    ff_shell.setMaterial(mp_shell->getMaterial());
     ff_shell.setAmbientMaterial(mp_ambient_material);
     p_result->addFormFactor(ff_shell, 1.0);
-    complex_t ambient_index = mp_ambient_material->getRefractiveIndex();
-    complex_t core_index = std::sqrt(mp_core->getRefractiveIndex()*mp_core->
-            getRefractiveIndex()
-            - mp_shell->getRefractiveIndex()*mp_shell->getRefractiveIndex()
-            + ambient_index*ambient_index);
-    FormFactorDecoratorRefractiveIndex ff_core(mp_core->getSimpleFormFactor()->
-            clone(),
-            core_index);
-    ff_core.setAmbientMaterial(mp_ambient_material);
-    FormFactorDecoratorPositionFactor ff_core_translated(ff_core,
-            m_relative_core_position);
-    p_result->addFormFactor(ff_core_translated, 1.0);
+    IFormFactor *p_core_simple = new FormFactorDecoratorPositionFactor(
+            *mp_core->getSimpleFormFactor(), m_relative_core_position);
+    FormFactorDecoratorMaterial ff_core(p_core_simple,
+            wavevector_scattering_factor);
+    ff_core.setMaterial(mp_core->getMaterial());
+    ff_core.setAmbientMaterial(mp_shell->getMaterial());
+    p_result->addFormFactor(ff_core, 1.0);
     return p_result;
 }
 
+void ParticleCoreShell::setSimpleFormFactor(IFormFactor* p_form_factor)
+{
+    if (p_form_factor != mp_form_factor) {
+        deregisterChild(mp_form_factor);
+        delete mp_form_factor;
+        mp_form_factor = p_form_factor;
+        registerChild(mp_form_factor);
+    }
+}
+
 ParticleCoreShell::ParticleCoreShell(kvector_t relative_core_position)
 : mp_shell(0)
 , mp_core(0)
diff --git a/Core/Samples/src/ParticleDecoration.cpp b/Core/Samples/src/ParticleDecoration.cpp
index 2044561de3633c69bc191909cd9a76fc0e2717fc..c9da76fa88f7de2ab94074a6fb9a2d93e7d5ad47 100644
--- a/Core/Samples/src/ParticleDecoration.cpp
+++ b/Core/Samples/src/ParticleDecoration.cpp
@@ -67,8 +67,9 @@ void ParticleDecoration::addParticle(
     Particle* p_particle, const Geometry::PTransform3D& transform,
     double depth, double abundance)
 {
+    p_particle->setTransform(transform);
     addAndRegisterParticleInfo(
-        new ParticleInfo(p_particle, transform, depth, abundance));
+        new ParticleInfo(p_particle, depth, abundance));
 }
 
 //! Adds generic particle, &-version.
@@ -77,8 +78,10 @@ void ParticleDecoration::addParticle(
     const Particle& p_particle, const Geometry::PTransform3D& transform,
     double depth, double abundance)
 {
+    Particle *p_particle_clone = p_particle.clone();
+    p_particle_clone->setTransform(transform);
     addAndRegisterParticleInfo(
-        new ParticleInfo(p_particle.clone(), transform, depth, abundance));
+        new ParticleInfo(p_particle_clone, depth, abundance));
 }
 
 //! Adds particle without rotation, *-version.
diff --git a/Core/Samples/src/ParticleInfo.cpp b/Core/Samples/src/ParticleInfo.cpp
index 22e8da8366c0b2e6a0814145d4c099bb7d10c963..db1dcd2e340629740ab1890f35641368d5385a89 100644
--- a/Core/Samples/src/ParticleInfo.cpp
+++ b/Core/Samples/src/ParticleInfo.cpp
@@ -15,40 +15,12 @@
 
 #include "ParticleInfo.h"
 
-ParticleInfo::ParticleInfo(
-    Particle* p_particle, const Geometry::PTransform3D& transform,
-    double depth, double abundance)
-    : mp_particle(p_particle)
-    , mP_transform(transform)
-    , m_depth(depth)
-    , m_abundance(abundance)
-{
-    setName("ParticleInfo");
-    registerChild(mp_particle);
-    init_parameters();
-}
-
-ParticleInfo::ParticleInfo(
-    const Particle& p_particle,
-    const Geometry::PTransform3D& transform,
-    double depth,
-    double abundance)
-    : mp_particle(p_particle.clone())
-    , mP_transform(transform)
-    , m_depth(depth)
-    , m_abundance(abundance)
-{
-    setName("ParticleInfo");
-    registerChild(mp_particle);
-    init_parameters();
-}
 
 ParticleInfo::ParticleInfo(
     Particle *p_particle,
     double depth,
     double abundance)
     : mp_particle(p_particle)
-    , mP_transform(Geometry::PTransform3D())
     , m_depth(depth)
     , m_abundance(abundance)
 {
@@ -62,7 +34,6 @@ ParticleInfo::ParticleInfo(
     double depth,
     double abundance)
     : mp_particle(p_particle.clone())
-    , mP_transform(Geometry::PTransform3D())
     , m_depth(depth)
     , m_abundance(abundance)
 {
@@ -83,12 +54,7 @@ void ParticleInfo::print(std::ostream& ostr) const
 {
     ostr << "ParticleInfo:" << getName() << "<" << this << "> : {" <<
         " depth=" << m_depth <<
-        ", abundance=" << m_abundance <<
-        ", transform=";
-    if ( mP_transform )
-        ostr << *mP_transform;
-    else
-        ostr << "NONE";
+        ", abundance=" << m_abundance;
     ostr << " }";
 }
 
diff --git a/Core/Samples/src/PositionParticleInfo.cpp b/Core/Samples/src/PositionParticleInfo.cpp
index ba332ff0c75baff0147ddaf4b1bdbcdb00fe36a6..ca653a4b46ee39d6c8afad342020bfab4a3c65bb 100644
--- a/Core/Samples/src/PositionParticleInfo.cpp
+++ b/Core/Samples/src/PositionParticleInfo.cpp
@@ -16,28 +16,6 @@
 #include "PositionParticleInfo.h"
 #include <iostream>
 
-PositionParticleInfo::PositionParticleInfo(
-    Particle* p_particle, const Geometry::PTransform3D& transform,
-    kvector_t position, double abundance)
-    : ParticleInfo(p_particle, transform, position.z(), abundance)
-    , m_pos_x(position.x())
-    , m_pos_y(position.y())
-{
-    setName("PositionParticleInfo");
-    init_parameters();
-}
-
-PositionParticleInfo::PositionParticleInfo(
-    const Particle& particle, const Geometry::PTransform3D& transform,
-    kvector_t position, double abundance)
-    : ParticleInfo(particle.clone(), transform, position.z(), abundance)
-    , m_pos_x(position.x())
-    , m_pos_y(position.y())
-{
-    setName("PositionParticleInfo");
-    init_parameters();
-}
-
 PositionParticleInfo::PositionParticleInfo(
     Particle* p_particle, kvector_t position, double abundance)
     : ParticleInfo(p_particle, position.z(), abundance)
@@ -62,7 +40,7 @@ PositionParticleInfo* PositionParticleInfo::clone() const
 {
     kvector_t position(m_pos_x, m_pos_y, -m_depth);
     return new PositionParticleInfo(
-        mp_particle->clone(), mP_transform, position, m_abundance);
+        mp_particle->clone(), position, m_abundance);
 }
 
 void PositionParticleInfo::setPosition(kvector_t position)
diff --git a/Core/StandardSamples/SampleBuilderFactory.h b/Core/StandardSamples/SampleBuilderFactory.h
index 9d7bd83a621e8cf19f0fd39e450246e79f7bf0ef..e551d065a1cf2e74b47a08546afbf958595debe4 100644
--- a/Core/StandardSamples/SampleBuilderFactory.h
+++ b/Core/StandardSamples/SampleBuilderFactory.h
@@ -8,7 +8,7 @@
 
 class BA_CORE_API_ SampleBuilderFactory : public IFactory<std::string, ISampleBuilder>
 {
- public:
+public:
     SampleBuilderFactory();
 
     ISample *createSample(const std::string& name);
diff --git a/Core/Tools/inc/AxisBin.h b/Core/Tools/inc/AxisBin.h
index 83c75b0dcc1014471f0f1132b0922d2787a3aaa1..ec262d3dcb00453fdfc89fb20757cd0ae860cd85 100644
--- a/Core/Tools/inc/AxisBin.h
+++ b/Core/Tools/inc/AxisBin.h
@@ -22,7 +22,7 @@
 
 class AxisBin : public IAxis
 {
- public:
+public:
     //! constructors
     AxisBin(std::string name);
     AxisBin(std::string name, size_t nbr_bins, double start, double end);
@@ -57,9 +57,9 @@ class AxisBin : public IAxis
 
 //    //! find the bin that contains the given value
 //    Bin1D findMatchingBin(double value) const;
- protected:
+protected:
     virtual bool equals(const IAxis& other) const;
- private:
+private:
     std::vector<double> m_value_vector;  //!< vector containing the bin limits
 };
 
diff --git a/Core/Tools/inc/AxisDouble.h b/Core/Tools/inc/AxisDouble.h
index a861939c582371d03eb219f65ae7ac4e38193ac3..d72a4042f0c746ff44719d81dcdda355f02ca1d0 100644
--- a/Core/Tools/inc/AxisDouble.h
+++ b/Core/Tools/inc/AxisDouble.h
@@ -25,7 +25,7 @@ class AxisBin;  // forward declaration needed for conversion constructor
 
 class BA_CORE_API_ AxisDouble : public IAxis
 {
- public:
+public:
     //! constructors
     AxisDouble(std::string name);
     AxisDouble(std::string name, size_t size, double start, double end);
@@ -68,10 +68,10 @@ class BA_CORE_API_ AxisDouble : public IAxis
     //! find the index that corresponds to the given upper bound (index is inclusive)
     size_t getUpperBoundIndex(double value) const;
 
- protected:
+protected:
     virtual bool equals(const IAxis& other) const;
 
- private:
+private:
     std::vector<double> m_sample_vector;  //!< vector containing the axis points
     double m_bin_size;
 };
diff --git a/Core/Tools/inc/Convolve.h b/Core/Tools/inc/Convolve.h
index 8bb005b314e90ff32a9b662501bedb1a44471d2d..e05b171b74cb56be55e0473a241909e4c7886ef2 100644
--- a/Core/Tools/inc/Convolve.h
+++ b/Core/Tools/inc/Convolve.h
@@ -37,7 +37,7 @@ namespace MathFunctions
 //!
 class Convolve
 {
- public:
+public:
     //! definition of 1d vector of double
     typedef std::vector<double > double1d_t;
 
@@ -63,7 +63,7 @@ class Convolve
     //! Sets convolution mode
     void setMode(Mode mode) { m_mode = mode; }
 
- private:
+private:
     //! compute circual convolution of source and kernel using fast Fourier transformation
     void fftw_circular_convolution(const double2d_t& source, const double2d_t& kernel);
 
diff --git a/Core/Tools/inc/Exceptions.h b/Core/Tools/inc/Exceptions.h
index 8125577d668ea7e99f8d465a1328619c593e714f..af63851d55ad2a37d003cf34f2b9c5c1e5db6426 100644
--- a/Core/Tools/inc/Exceptions.h
+++ b/Core/Tools/inc/Exceptions.h
@@ -28,98 +28,98 @@
 
 namespace Exceptions {
 
-    class BA_CORE_API_ NotImplementedException : public std::logic_error
-    {
-    public:
-        NotImplementedException(const std::string& message);
-    };
-
-    class BA_CORE_API_ NullPointerException : public std::logic_error
-    {
-    public:
-        NullPointerException(const std::string& message);
-    };
-
-    class BA_CORE_API_ OutOfBoundsException : public std::logic_error
-    {
-    public:
-        OutOfBoundsException(const std::string& message);
-    };
-
-    class BA_CORE_API_ ClassInitializationException : public std::runtime_error
-    {
-    public:
-        ClassInitializationException(const std::string& message);
-    };
-
-    class BA_CORE_API_ SelfReferenceException : public std::logic_error
-    {
-    public:
-        SelfReferenceException(const std::string& message);
-    };
-
-    class BA_CORE_API_ DeadReferenceException : public std::runtime_error
-    {
-    public:
-        DeadReferenceException(const std::string& message);
-    };
-
-    class BA_CORE_API_ UnknownClassRegistrationException : public std::runtime_error
-    {
-    public:
-        UnknownClassRegistrationException(const std::string& message);
-    };
-
-    class BA_CORE_API_ ExistingClassRegistrationException : public std::runtime_error
-    {
-    public:
-        ExistingClassRegistrationException(const std::string& message);
-    };
-
-    class BA_CORE_API_ LogicErrorException : public std::logic_error
-    {
-    public:
-        LogicErrorException(const std::string& message);
-    };
-
-    class BA_CORE_API_ RuntimeErrorException : public std::runtime_error
-    {
-    public:
-        RuntimeErrorException(const std::string& message);
-    };
-
-    class BA_CORE_API_ DivisionByZeroException : public std::runtime_error
-    {
-    public:
-        DivisionByZeroException(const std::string& message);
-    };
-
-    class BA_CORE_API_ DomainErrorException : public std::domain_error
-    {
-    public:
-        DomainErrorException(const std::string& message);
-    };
-
-    class BA_CORE_API_ FileNotIsOpenException : public std::runtime_error
-    {
-    public:
-        FileNotIsOpenException(const std::string& message);
-    };
-
-
-    class BA_CORE_API_ FileIsBadException : public std::runtime_error
-    {
-    public:
-        FileIsBadException(const std::string& message);
-    };
-
-    class BA_CORE_API_ FormatErrorException : public std::runtime_error
-    {
-    public:
-        FormatErrorException(const std::string& message);
-    };
-
-    void LogExceptionMessage(const std::string& message);
+class BA_CORE_API_ NotImplementedException : public std::logic_error
+{
+public:
+    NotImplementedException(const std::string& message);
+};
+
+class BA_CORE_API_ NullPointerException : public std::logic_error
+{
+public:
+    NullPointerException(const std::string& message);
+};
+
+class BA_CORE_API_ OutOfBoundsException : public std::logic_error
+{
+public:
+    OutOfBoundsException(const std::string& message);
+};
+
+class BA_CORE_API_ ClassInitializationException : public std::runtime_error
+{
+public:
+    ClassInitializationException(const std::string& message);
+};
+
+class BA_CORE_API_ SelfReferenceException : public std::logic_error
+{
+public:
+    SelfReferenceException(const std::string& message);
+};
+
+class BA_CORE_API_ DeadReferenceException : public std::runtime_error
+{
+public:
+    DeadReferenceException(const std::string& message);
+};
+
+class BA_CORE_API_ UnknownClassRegistrationException : public std::runtime_error
+{
+public:
+    UnknownClassRegistrationException(const std::string& message);
+};
+
+class BA_CORE_API_ ExistingClassRegistrationException : public std::runtime_error
+{
+public:
+    ExistingClassRegistrationException(const std::string& message);
+};
+
+class BA_CORE_API_ LogicErrorException : public std::logic_error
+{
+public:
+    LogicErrorException(const std::string& message);
+};
+
+class BA_CORE_API_ RuntimeErrorException : public std::runtime_error
+{
+public:
+    RuntimeErrorException(const std::string& message);
+};
+
+class BA_CORE_API_ DivisionByZeroException : public std::runtime_error
+{
+public:
+    DivisionByZeroException(const std::string& message);
+};
+
+class BA_CORE_API_ DomainErrorException : public std::domain_error
+{
+public:
+    DomainErrorException(const std::string& message);
+};
+
+class BA_CORE_API_ FileNotIsOpenException : public std::runtime_error
+{
+public:
+    FileNotIsOpenException(const std::string& message);
+};
+
+
+class BA_CORE_API_ FileIsBadException : public std::runtime_error
+{
+public:
+    FileIsBadException(const std::string& message);
+};
+
+class BA_CORE_API_ FormatErrorException : public std::runtime_error
+{
+public:
+    FormatErrorException(const std::string& message);
+};
+
+void LogExceptionMessage(const std::string& message);
 
 }
 
diff --git a/Core/Tools/inc/FastVector.h b/Core/Tools/inc/FastVector.h
index 911b42feff6f527af382e4a7e2a04213093d21d2..7e17a44b99d0f7295f938509d64f1a23e4dd4fdd 100644
--- a/Core/Tools/inc/FastVector.h
+++ b/Core/Tools/inc/FastVector.h
@@ -22,7 +22,7 @@
 //! A Vector of kvector_t's with optimised location/deallocation.
 
 class KVectorContainer {
- public:
+public:
     typedef std::vector<kvector_t > container_t;
     typedef container_t::const_iterator const_iterator;
     KVectorContainer(int buff_size = 3)
@@ -59,7 +59,7 @@ class KVectorContainer {
     const_iterator begin() const { return m_buffer.begin(); }
     const_iterator end() const { return m_buffer.begin()+m_current_position; }
 
- private:
+private:
     size_t m_current_position;
     size_t m_max_buff_size;
     container_t m_buffer;
diff --git a/Core/Tools/inc/IAxis.h b/Core/Tools/inc/IAxis.h
index f59488c0d767c8543b3692cfe506a4ae60040942..416c9e3befe64fe1320b25d0d58fae2cfc0e8b92 100644
--- a/Core/Tools/inc/IAxis.h
+++ b/Core/Tools/inc/IAxis.h
@@ -22,7 +22,7 @@
 
 class BA_CORE_API_ IAxis
 {
- public:
+public:
     //! constructors
     IAxis(std::string name) : m_name(name) {}
 
@@ -64,7 +64,7 @@ class BA_CORE_API_ IAxis
         return left.equals(right);
     }
 
- protected:
+protected:
     virtual bool equals(const IAxis& other) const;
     std::string m_name;  //!< axis label
 };
diff --git a/Core/Tools/inc/IChangeable.h b/Core/Tools/inc/IChangeable.h
index 29a5e6b6b64267548266230bc411d4d8d838d274..5865162ae6e305acecd6fd3bcfd69cd7c2ea7206 100644
--- a/Core/Tools/inc/IChangeable.h
+++ b/Core/Tools/inc/IChangeable.h
@@ -20,7 +20,7 @@
 
 class IChangeable
 {
- public:
+public:
     IChangeable(bool is_changed=false) : m_is_changed(is_changed){}
     virtual ~IChangeable(){}
 
@@ -33,7 +33,7 @@ class IChangeable
 
     void setIsChanged(bool is_changed) { m_is_changed = is_changed; }
 
- private:
+private:
     bool m_is_changed;
 };
 
diff --git a/Core/Tools/inc/IFactory.h b/Core/Tools/inc/IFactory.h
index d28c2799bb4d655c1b851cd9b20c93a3a3dfb220..875809c891311cc5b2c16a2130879986962c3a9a 100644
--- a/Core/Tools/inc/IFactory.h
+++ b/Core/Tools/inc/IFactory.h
@@ -26,7 +26,7 @@
 template<class IdentifierType, class AbstractProduct >
 class IFactory
 {
- public:
+public:
     //! function which will be used to create object of AbstractProduct base type
     typedef AbstractProduct* (*CreateItemCallback) ();
 
@@ -101,7 +101,7 @@ class IFactory
     //! Returns number of registered objects
     size_t getNumberOfRegistered() const { return m_callbacks.size(); }
 
- protected:
+protected:
     bool m_own_objects;         //!< will store created objects in the list and then delete them on exit then true
     CallbackMap_t m_callbacks;     //!< map of correspondance of objectsId and creation functions
     DescriptionMap_t m_descriptions;     //!< map of correspondance of objectsId and description
diff --git a/Core/Tools/inc/INamed.h b/Core/Tools/inc/INamed.h
index 83c6ddf9b85ff697826d68b09513441172bdc87e..676d1bbacf9eac19f4588b32d9b1332b33f8dc54 100644
--- a/Core/Tools/inc/INamed.h
+++ b/Core/Tools/inc/INamed.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ INamed
 {
- public:
+public:
     //! Default constructor, setting name="".
     INamed() : m_name() {}
 
@@ -39,7 +39,7 @@ class BA_CORE_API_ INamed
     //! Returns the name.
     std::string getName() const { return m_name; }
 
- protected:
+protected:
     //! The name of this object.
     std::string m_name;
 };
diff --git a/Core/Tools/inc/IObserver.h b/Core/Tools/inc/IObserver.h
index 3a5c7d87ab7df847f6b0be61e32cc26ca4a0ce65..e324a19cd9a255f2ebad8929ae67768570a0ee6c 100644
--- a/Core/Tools/inc/IObserver.h
+++ b/Core/Tools/inc/IObserver.h
@@ -26,7 +26,7 @@ class IObservable;
 //! Observer interface from Observer pattern, for 1:n object dependencies.
 
 class BA_CORE_API_ IObserver {
- public:
+public:
 //    IObserver() : m_observed_subject(0) {}
     virtual ~IObserver() {}
 
@@ -42,7 +42,7 @@ class BA_CORE_API_ IObserver {
 //! Observable interface from Observer pattern, for 1:n object dependencies.
 
 class BA_CORE_API_ IObservable {
- public:
+public:
     typedef boost::shared_ptr<IObserver > observer_t;
     typedef std::list<observer_t > observerlist_t;
 
@@ -54,7 +54,7 @@ class BA_CORE_API_ IObservable {
     //! notify observers about change in status
     virtual void notifyObservers();
 
- private:
+private:
     observerlist_t m_observers;
 };
 
diff --git a/Core/Tools/inc/IParameterized.h b/Core/Tools/inc/IParameterized.h
index 93c9e4e58bf2f3a8a7d09d3dd5aec52fe6bf1ce3..66404d115f6e7fcfe81c12eacc159a69b590ee3b 100644
--- a/Core/Tools/inc/IParameterized.h
+++ b/Core/Tools/inc/IParameterized.h
@@ -24,7 +24,7 @@
 
 class BA_CORE_API_ IParameterized : public INamed
 {
- public:
+public:
     IParameterized()
         : m_parameters(), m_status() {}
     IParameterized(const std::string& name)
@@ -64,7 +64,7 @@ class BA_CORE_API_ IParameterized : public INamed
     //! clear parameter pool
     virtual void clearParameterPool() { m_parameters.clear(); }
 
- protected:
+protected:
     //! Throw non-implemented exception (needed for Python).
     virtual void init_parameters();
 
diff --git a/Core/Tools/inc/ISingleton.h b/Core/Tools/inc/ISingleton.h
index 0bbc693638ec57eb8ebbb3a8be018f02edefc1ee..f937e453cec042929ce613fb9d09d3ae0c0116f4 100644
--- a/Core/Tools/inc/ISingleton.h
+++ b/Core/Tools/inc/ISingleton.h
@@ -28,7 +28,7 @@ GCC_DIAG_ON(strict-aliasing);
 template <class T>
 class ISingleton
 {
- public:
+public:
     static T& instance()
     {
         static boost::mutex single_mutex;
@@ -43,7 +43,7 @@ class ISingleton
         return *m_instance;
     }
 
- protected:
+protected:
     ISingleton(){}
     virtual ~ISingleton()
     {
@@ -61,7 +61,7 @@ class ISingleton
 
     typedef T* T_Pointer;
 
- private:
+private:
     ISingleton(const ISingleton<T>& ) {}
     ISingleton& operator=(const ISingleton<T>& ) { throw std::runtime_error("ISingleton::operator=()"); }
 
diff --git a/Core/Tools/inc/IStochasticParameter.h b/Core/Tools/inc/IStochasticParameter.h
index e5be762f98898c0bc82727f405e5897621530b59..d710aca0de8863a1346340cbb7129ce1fe948d8c 100644
--- a/Core/Tools/inc/IStochasticParameter.h
+++ b/Core/Tools/inc/IStochasticParameter.h
@@ -20,7 +20,7 @@
 
 class BA_CORE_API_ IStochasticParameter : public ICloneable
 {
- public:
+public:
     virtual ~IStochasticParameter() {}
     virtual void setToRandom()=0;
     virtual void setToAverage()=0;
@@ -28,7 +28,7 @@ class BA_CORE_API_ IStochasticParameter : public ICloneable
 
 template <class T> class BA_CORE_API_ StochasticParameter : public IStochasticParameter
 {
- public:
+public:
     StochasticParameter(T average) : m_average(average)
 	{
 		setToAverage();
@@ -56,7 +56,7 @@ template <class T> class BA_CORE_API_ StochasticParameter : public IStochasticPa
     virtual double probabilityDensity(T value) const=0;
     virtual double getFWHM() const { return 0.0;}
 
- protected:
+protected:
     T m_current;
     T m_average;
 };
diff --git a/Core/Tools/inc/LLData.h b/Core/Tools/inc/LLData.h
index 39e91290405d435c80fb91010e28ba8960d321bd..53141a1856c734257a53f2cd218b9e85e0d0e1d6 100644
--- a/Core/Tools/inc/LLData.h
+++ b/Core/Tools/inc/LLData.h
@@ -25,7 +25,7 @@
 
 template <class T> class LLData
 {
- public:
+public:
     // construction, destruction and assignment
     LLData(size_t rank, const int *dimensions);
     LLData(const LLData<T>& right);
@@ -54,7 +54,7 @@ template <class T> class LLData
     const int *getDimensions() const { return m_dims; }
     T getTotalSum() const;
 
- private:
+private:
     void allocate(size_t rank, const int *dimensions);
     void clear();
     int checkPositiveDimension(int dimension) const;
diff --git a/Core/Tools/inc/MemberComplexFunctionIntegrator.h b/Core/Tools/inc/MemberComplexFunctionIntegrator.h
index bccccd5626f6bd64d36bafb439331b0df875039c..b8458deb31ea9e710d9ee3b1d030a3cd0e41f0c3 100644
--- a/Core/Tools/inc/MemberComplexFunctionIntegrator.h
+++ b/Core/Tools/inc/MemberComplexFunctionIntegrator.h
@@ -21,7 +21,7 @@
 
 template <class C> class MemberComplexFunctionIntegrator
 {
- public:
+public:
     //! member function type
     typedef complex_t (C::*mem_function)(double, void*) const;
 
@@ -30,7 +30,7 @@ template <class C> class MemberComplexFunctionIntegrator
 
     complex_t integrate(double lmin, double lmax);
 
- private:
+private:
 
     double integrand_real(double z, void* pars) const {
         return ((mp_object->*m_member_function)(z, pars)).real();
diff --git a/Core/Tools/inc/MemberFunctionIntegrator.h b/Core/Tools/inc/MemberFunctionIntegrator.h
index 918d148f01cc5cf59c522f0c0f5967447a74408b..4535584930cc76dae5039f14c8eadb066df00cb8 100644
--- a/Core/Tools/inc/MemberFunctionIntegrator.h
+++ b/Core/Tools/inc/MemberFunctionIntegrator.h
@@ -23,7 +23,7 @@
 
 template <class C> class MemberFunctionIntegrator
 {
- public:
+public:
     //! member function type
     typedef double (C::*mem_function)(double, void*) const;
 
@@ -49,7 +49,7 @@ template <class C> class MemberFunctionIntegrator
     void setIntegrand(mem_function member_function, const C *const p_object)
     { m_member_function = member_function; mp_object = p_object; }
 
- private:
+private:
     //! static function that can be passed to gsl integrator
     static double StaticCallBack(double d, void *v) {
         CallBackHolder *p_cb = static_cast<CallBackHolder *>(v);
diff --git a/Core/Tools/inc/MessageService.h b/Core/Tools/inc/MessageService.h
index 48a632dc567576bbe9a7612ca2d45a4df88c7268..c7d3fcdc60ee565b09ef637d10d788a4e1cdba80 100644
--- a/Core/Tools/inc/MessageService.h
+++ b/Core/Tools/inc/MessageService.h
@@ -18,7 +18,7 @@ enum MessageLevel { VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL };
 
 class BA_CORE_API_ Logger
 {
- public:
+public:
     Logger(MessageLevel level);
 
     template <typename T>
@@ -36,7 +36,7 @@ class BA_CORE_API_ Logger
     static void SetLevel(const std::string& levelname);
     static MessageLevel GetLevel();
 
- private:
+private:
     static MessageLevel m_logLevel;
     static std::vector<std::string > m_level_names;
     std::ostringstream m_buffer;
diff --git a/Core/Tools/inc/OutputData.h b/Core/Tools/inc/OutputData.h
index ad584dbbbe83ac7b742e67f09a53f9bc9c17cbd9..5f8503514604091ead3921199cd1ecb1681f3a6f 100644
--- a/Core/Tools/inc/OutputData.h
+++ b/Core/Tools/inc/OutputData.h
@@ -30,7 +30,7 @@
 template <class T>
 class OutputData
 {
- public:
+public:
     OutputData();
     ~OutputData() { clear(); }
     OutputData* clone() const;
@@ -200,7 +200,7 @@ class OutputData
 
     //! Returns true if object have same dimensions and shape of axises
     bool hasSameShape(const OutputData<T>& right) const;
- private:
+private:
     //! disabled copy constructor and assignment operators
     OutputData(const OutputData& );
     const OutputData& operator=(const OutputData& );
diff --git a/Core/Tools/inc/OutputDataIOFactory.h b/Core/Tools/inc/OutputDataIOFactory.h
index cda97c1907101bfd08e95a328365f2e80a15135d..dfbef2a62cf7326c5d781a906a243d31e3bb5270 100644
--- a/Core/Tools/inc/OutputDataIOFactory.h
+++ b/Core/Tools/inc/OutputDataIOFactory.h
@@ -27,7 +27,7 @@
 
 class BA_CORE_API_ OutputDataIOFactory
 {
- public:
+public:
     typedef boost::shared_ptr<OutputDataReader > OutputDataReader_t;
     typedef boost::shared_ptr<OutputDataWriter > OutputDataWriter_t;
 
diff --git a/Core/Tools/inc/OutputDataIterator.h b/Core/Tools/inc/OutputDataIterator.h
index f37e964357cffebdaef664a4aa67ed28f786b932..8ef4c192e454a778fc7e1dd5357c54c05f756e28 100644
--- a/Core/Tools/inc/OutputDataIterator.h
+++ b/Core/Tools/inc/OutputDataIterator.h
@@ -24,7 +24,7 @@
 
 template <class TValue, class TContainer> class OutputDataIterator
 {
- public:
+public:
     //! Empty constructor to comply with stl forward iterators
     OutputDataIterator();
 
@@ -87,7 +87,7 @@ template <class TValue, class TContainer> class OutputDataIterator
     typedef TValue& reference;
 #endif
 
- protected:
+protected:
     virtual void swapContents(OutputDataIterator<TValue, TContainer>& other);
     size_t m_current_index;
     TContainer *mp_output_data;
diff --git a/Core/Tools/inc/OutputDataReadStrategy.h b/Core/Tools/inc/OutputDataReadStrategy.h
index 2de88446b67c8efd498aae4c93c47c3d8d8af1d3..7ed26503723a9d2374e52cea7a60a11c1e8f52d3 100644
--- a/Core/Tools/inc/OutputDataReadStrategy.h
+++ b/Core/Tools/inc/OutputDataReadStrategy.h
@@ -24,7 +24,7 @@
 
 class IOutputDataReadStrategy
 {
- public:
+public:
     IOutputDataReadStrategy(){}
     virtual ~IOutputDataReadStrategy(){}
 
@@ -32,17 +32,17 @@ class IOutputDataReadStrategy
 
     //! returns true if strategy needs binary stream
     virtual bool isBinary() { return false; }
- private:
+private:
 };
 
 //! Interface for decoration of read strategies (e.g. gzip compression)
 
 class IOutputDataReadStrategyDecorator : public IOutputDataReadStrategy
 {
- public:
+public:
     IOutputDataReadStrategyDecorator(IOutputDataReadStrategy *read_strategy) : m_read_strategy(read_strategy) {}
     virtual ~IOutputDataReadStrategyDecorator() { delete m_read_strategy; }
- protected:
+protected:
     IOutputDataReadStrategy *m_read_strategy;
 };
 
@@ -50,7 +50,7 @@ class IOutputDataReadStrategyDecorator : public IOutputDataReadStrategy
 
 class OutputDataReadStreamGZip : public IOutputDataReadStrategyDecorator
 {
- public:
+public:
     OutputDataReadStreamGZip(IOutputDataReadStrategy *read_strategy) : IOutputDataReadStrategyDecorator(read_strategy) { }
     virtual ~OutputDataReadStreamGZip() { }
 
@@ -64,7 +64,7 @@ class OutputDataReadStreamGZip : public IOutputDataReadStrategyDecorator
 
 class OutputDataReadStreamIMA : public IOutputDataReadStrategy
 {
- public:
+public:
     OutputData<double > *readOutputData(std::istream& file_stream);
 };
 
@@ -73,7 +73,7 @@ class OutputDataReadStreamIMA : public IOutputDataReadStrategy
 
 class OutputDataReadStreamV1 : public IOutputDataReadStrategy
 {
- public:
+public:
     OutputData<double > *readOutputData(std::istream& file_stream);
 };
 
diff --git a/Core/Tools/inc/OutputDataReader.h b/Core/Tools/inc/OutputDataReader.h
index f6d810dccc6bec35101fb9348794f9154c3217fb..22f49b952d5548d7ec8518481fa46ab4ff8d8687 100644
--- a/Core/Tools/inc/OutputDataReader.h
+++ b/Core/Tools/inc/OutputDataReader.h
@@ -23,7 +23,7 @@
 
 class OutputDataReader
 {
- public:
+public:
     OutputDataReader() : m_read_strategy(0) {}
     OutputDataReader(const std::string& file_name) : m_file_name(file_name), m_read_strategy(0) {}
     OutputDataReader(IOutputDataReadStrategy *read_strategy) : m_read_strategy(read_strategy) {}
@@ -36,7 +36,7 @@ class OutputDataReader
     //! Sets concrete reading strategy
     void setStrategy(IOutputDataReadStrategy *read_strategy) { delete m_read_strategy; m_read_strategy = read_strategy; }
 
- private:
+private:
 //    //! read output data from file
 //    OutputData<double > *getOutputData(const std::string& file_name);
 
diff --git a/Core/Tools/inc/OutputDataWriteStrategy.h b/Core/Tools/inc/OutputDataWriteStrategy.h
index 552ecec7d36daf66d6d7220dc74aac3697d1cd15..766db7a115e31f5e5e2f0c3a0a3bd2d3d0072cff 100644
--- a/Core/Tools/inc/OutputDataWriteStrategy.h
+++ b/Core/Tools/inc/OutputDataWriteStrategy.h
@@ -24,12 +24,12 @@
 
 class IOutputDataWriteStrategy
 {
- public:
+public:
     IOutputDataWriteStrategy() : m_precision(10) {}
     virtual ~IOutputDataWriteStrategy(){}
 
     virtual void writeOutputData(const OutputData<double>& data, std::ostream& output_stream) = 0;
- protected:
+protected:
     int m_precision;
 };
 
@@ -37,7 +37,7 @@ class IOutputDataWriteStrategy
 
 class OutputDataWriteStreamIMA : public IOutputDataWriteStrategy
 {
- public:
+public:
     virtual void writeOutputData(const OutputData<double>& data, std::ostream& output_stream);
 };
 
diff --git a/Core/Tools/inc/OutputDataWriter.h b/Core/Tools/inc/OutputDataWriter.h
index f63f260f233888e7c162628bde75876ce6e1b9c6..13726159f3385a33faa5e91809fc191b7399f77f 100644
--- a/Core/Tools/inc/OutputDataWriter.h
+++ b/Core/Tools/inc/OutputDataWriter.h
@@ -23,7 +23,7 @@
 
 class OutputDataWriter
 {
- public:
+public:
     OutputDataWriter() : m_write_strategy(0) {}
     OutputDataWriter(const std::string& file_name) : m_file_name(file_name), m_write_strategy(0) {}
     OutputDataWriter(IOutputDataWriteStrategy *write_strategy) : m_write_strategy(write_strategy) {}
@@ -35,7 +35,7 @@ class OutputDataWriter
     //! Sets concrete writing strategy
     void setStrategy(IOutputDataWriteStrategy *write_strategy) { delete m_write_strategy; m_write_strategy = write_strategy; }
 
- private:
+private:
     std::string m_file_name;
     IOutputDataWriteStrategy *m_write_strategy;
 };
diff --git a/Core/Tools/inc/ParameterPool.h b/Core/Tools/inc/ParameterPool.h
index 1d36436f56f6bf3fc26f7ff816058c802ddce5d5..5370957320a75dd39b86306ef44c884cce5383a1 100644
--- a/Core/Tools/inc/ParameterPool.h
+++ b/Core/Tools/inc/ParameterPool.h
@@ -26,7 +26,7 @@
 
 class BA_CORE_API_ ParameterPool : public ICloneable
 {
- public:
+public:
     //! definition of parameter type and parameter container
     typedef RealParameterWrapper parameter_t;
     typedef std::map<std::string, parameter_t > parametermap_t;
@@ -86,7 +86,7 @@ class BA_CORE_API_ ParameterPool : public ICloneable
                                     const ParameterPool& obj)
     { obj.print(ostr); return ostr; }
 
- protected:
+protected:
     //! Prints parameter pool contents.
     virtual void print(std::ostream& ostr) const;
 
diff --git a/Core/Tools/inc/ProgramOptions.h b/Core/Tools/inc/ProgramOptions.h
index 7219d07d656874d19b10eb4e515d2bed391995ef..6cbec124c070a1d166c561ff656ff43455be0af5 100644
--- a/Core/Tools/inc/ProgramOptions.h
+++ b/Core/Tools/inc/ProgramOptions.h
@@ -35,7 +35,7 @@ namespace bpo = boost::program_options;
 
 class ProgramOptions
 {
- public:
+public:
     typedef bpo::options_description Variables_t;
 
     ProgramOptions();
@@ -70,7 +70,7 @@ class ProgramOptions
     //! Returns reference to the positional options description
     bpo::positional_options_description& getPositionalOptions() { return m_positional_options; }
 
- private:
+private:
     bool m_options_is_consistent;       //! true if options are consistent (no conflicts, no --help request)
     bpo::options_description m_options; //! options description, to be filled with add() from different program modules
     bpo::positional_options_description m_positional_options; //! positional options description, to be filled with addPositional() from main module
diff --git a/Core/Tools/inc/RealParameterWrapper.h b/Core/Tools/inc/RealParameterWrapper.h
index 3db61aa68aa392418b07f7c87fdeb551ffa11dfc..87b19f05eba9426d2a98cc598547e1094e4b0a8b 100644
--- a/Core/Tools/inc/RealParameterWrapper.h
+++ b/Core/Tools/inc/RealParameterWrapper.h
@@ -24,7 +24,7 @@
 //! Wrapper to real parameter for remote access to its value and callback abilities
 
 class BA_CORE_API_ RealParameterWrapper {
- public:
+public:
     explicit RealParameterWrapper(double *par) : m_data(par) {}
     // explicit RealParameterWrapper(double *par) : m_data(par), m_signal() {}
     RealParameterWrapper(const RealParameterWrapper& other );
@@ -52,7 +52,7 @@ class BA_CORE_API_ RealParameterWrapper {
 
     //! Prints the parameter's address to an output stream
     friend std::ostream& operator<<(std::ostream& ostr, const RealParameterWrapper& p) { ostr << p.m_data; return ostr; }
- private:
+private:
     //! swap function
     void swapContent(RealParameterWrapper& other);
 
diff --git a/Core/Tools/inc/StochasticDiracDelta.h b/Core/Tools/inc/StochasticDiracDelta.h
index ab14e58f6050a4c2d501e1cf30929e1db724ca0f..905dc1728770151ea3518dbb40dd467960a283d8 100644
--- a/Core/Tools/inc/StochasticDiracDelta.h
+++ b/Core/Tools/inc/StochasticDiracDelta.h
@@ -20,7 +20,7 @@
 
 template <class T> class StochasticDiracDelta : public StochasticParameter<T>
 {
- public:
+public:
     StochasticDiracDelta(T average);
     virtual ~StochasticDiracDelta() {}
     virtual StochasticDiracDelta *clone() const;
@@ -29,7 +29,7 @@ template <class T> class StochasticDiracDelta : public StochasticParameter<T>
     virtual void setToRandom() {}
     virtual double probabilityDensity(T /*value*/) const { return 0.0; }
 
- private:
+private:
     //! copy constructor and assignment operator are hidden since there is a clone method
     StochasticDiracDelta(const StochasticDiracDelta<T>& );
     StochasticDiracDelta<T>& operator=(const StochasticDiracDelta<T>& );
diff --git a/Core/Tools/inc/StochasticDoubleGate.h b/Core/Tools/inc/StochasticDoubleGate.h
index f5be725ec87666da1463d9f0f20e3770c6b8d76e..04a46c677abf9904423e9a28cbd89782b915a41c 100644
--- a/Core/Tools/inc/StochasticDoubleGate.h
+++ b/Core/Tools/inc/StochasticDoubleGate.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ StochasticDoubleGate : public StochasticParameter<double>
 {
- public:
+public:
     StochasticDoubleGate(double min, double max);
     ~StochasticDoubleGate() {}
     virtual StochasticDoubleGate *clone() const {
@@ -40,7 +40,7 @@ class BA_CORE_API_ StochasticDoubleGate : public StochasticParameter<double>
 
     virtual double getFWHM() const { return m_max-m_min; }
 
- private:
+private:
     double m_min, m_max;
 };
 
diff --git a/Core/Tools/inc/StochasticGaussian.h b/Core/Tools/inc/StochasticGaussian.h
index c7feaf131be18c2f3e38d28156a1e12193f768df..e65dc555ad5fb49ccb17be13042c115ac2779642 100644
--- a/Core/Tools/inc/StochasticGaussian.h
+++ b/Core/Tools/inc/StochasticGaussian.h
@@ -21,7 +21,7 @@
 
 class BA_CORE_API_ StochasticDoubleGaussian : public StochasticParameter<double>
 {
- public:
+public:
     StochasticDoubleGaussian(double average, double std_dev);
     ~StochasticDoubleGaussian();
     virtual StochasticDoubleGaussian *clone() const;
@@ -33,7 +33,7 @@ class BA_CORE_API_ StochasticDoubleGaussian : public StochasticParameter<double>
 
     virtual double getFWHM() const { return 2.*m_std_dev*std::sqrt(2.*std::log(2.)); }
 
- private:
+private:
     double m_std_dev;
 };
 
diff --git a/Core/Tools/inc/StochasticSampledParameter.h b/Core/Tools/inc/StochasticSampledParameter.h
index 5de88b84e068918aa6e237e5d32fae683e7415b5..e5f198b3cf1f06af6a3f6e51cdfa33b42edc8d36 100644
--- a/Core/Tools/inc/StochasticSampledParameter.h
+++ b/Core/Tools/inc/StochasticSampledParameter.h
@@ -23,7 +23,7 @@
 
 class BA_CORE_API_ StochasticSampledParameter : public StochasticParameter<double>
 {
- public:
+public:
     //! constructor with nbins, xmin, xmax
     StochasticSampledParameter(const StochasticParameter<double>& par, size_t nbins, double xmin, double xmax);
     //! constructor with nbin and nfwhm to derive xmin and xmax
@@ -57,7 +57,7 @@ class BA_CORE_API_ StochasticSampledParameter : public StochasticParameter<doubl
     //! clone method
     virtual StochasticSampledParameter *clone() const;
 
- private:
+private:
     StochasticParameter<double > *m_stochastic_parameter;
     size_t m_nbins;
     double m_xmin;
diff --git a/Core/Tools/inc/TRange.h b/Core/Tools/inc/TRange.h
index bb423e137f6bfda86c979d4bac0d8cd966de7753..5dd8cac427275f61fc21730d240ae3bae3b59b6f 100644
--- a/Core/Tools/inc/TRange.h
+++ b/Core/Tools/inc/TRange.h
@@ -20,7 +20,7 @@
 
 template <class T> class TRange
 {
- public:
+public:
     TRange(T min, T max) : m_min(min), m_max(max) {}
     virtual ~TRange(){}
 
@@ -29,7 +29,7 @@ template <class T> class TRange
     T getDifference() const { return m_max-m_min; }
 
     bool inRange(T value) const { return value >= m_min && value < m_max; }
- private:
+private:
     T m_min, m_max;
 };
 
@@ -37,12 +37,12 @@ template <class T> class TRange
 
 template <class T> class TSampledRange : public TRange<T>
 {
- public:
+public:
     TSampledRange(size_t n_samples, T min, T max)
         : TRange<T>(min, max), m_n_samples(n_samples) {}
 
     size_t getNSamples() const { return m_n_samples; }
- private:
+private:
     size_t m_n_samples;
 };
 
diff --git a/Core/Tools/inc/Utils.h b/Core/Tools/inc/Utils.h
index cd294b0461119b0e0d267aad4e31a35699a22151..68cc1f52979be7bea9552b85c9e3cb4534a542d2 100644
--- a/Core/Tools/inc/Utils.h
+++ b/Core/Tools/inc/Utils.h
@@ -28,7 +28,7 @@ namespace Utils {
 
 class BA_CORE_API_ String
 {
- public:
+public:
     //! Parse double values from string to vector of double.
     static vdouble1d_t parse_doubles(const std::string& str);
 
@@ -48,7 +48,7 @@ class BA_CORE_API_ String
 
 class StringUsageMap
 {
- public:
+public:
     typedef std::map<std::string, int> nstringmap_t;
     typedef nstringmap_t::iterator iterator_t;
 
@@ -77,7 +77,7 @@ class StringUsageMap
     //! Returns current string
     std::string get_current() const { return m_current_string; }
 
- private:
+private:
     std::string m_current_string;
     nstringmap_t m_nstringmap;
 };
@@ -86,7 +86,7 @@ class StringUsageMap
 
 class BA_CORE_API_ FileSystem
 {
- public:
+public:
     //! Returns path to the current (working) directory
     static std::string GetWorkingPath();
 
@@ -112,7 +112,7 @@ class BA_CORE_API_ FileSystem
     //! returns absolute path to data taking into acount location of executable
     static std::string GetPathToData(const std::string& rel_data_path, const std::string& argv0=GetArgvPath());
 
- private:
+private:
     static std::string m_argv0_path; //!< it's value of argv[0], i.e. the path from working directory to executable module including the name of executable module
 };
 
diff --git a/Tests/FunctionalTests/TestCore/IsGISAXS07/IsGISAXS07.cpp b/Tests/FunctionalTests/TestCore/IsGISAXS07/IsGISAXS07.cpp
index 5873d4b2de48918b7c97aae8a6f3002692b6440f..7e3a4b9306ec132d3b6b0b1c7edab35c7a2cc96a 100644
--- a/Tests/FunctionalTests/TestCore/IsGISAXS07/IsGISAXS07.cpp
+++ b/Tests/FunctionalTests/TestCore/IsGISAXS07/IsGISAXS07.cpp
@@ -36,63 +36,83 @@ void FunctionalTests::IsGISAXS07::run()
     ParticleDecoration particle_decoration;
 
     // add particle number 1:
-    FormFactorBox ff1(1.0*Units::nanometer, 1.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff1(1.0*Units::nanometer, 1.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos1(0.0*Units::nanometer, 0.0*Units::nanometer, 0.0);
-    PositionParticleInfo particle_info1(new Particle(particle_material, ff1), pos1, 0.5);
+    PositionParticleInfo particle_info1(new Particle(particle_material, ff1),
+            pos1, 0.5);
     particle_decoration.addParticleInfo(particle_info1);
     // add particle number 2:
-    FormFactorBox ff2(1.0*Units::nanometer, 2.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff2(1.0*Units::nanometer, 2.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos2(5.0*Units::nanometer, 5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m2( new Geometry::RotateZ_3D(10*Units::degree));
-    PositionParticleInfo particle_info2(new Particle(particle_material, ff2), m2, pos2, 0.5);
+    PositionParticleInfo particle_info2(
+            new Particle(particle_material, ff2, m2), pos2, 0.5);
     particle_decoration.addParticleInfo(particle_info2);
     // add particle number 3:
-    FormFactorBox ff3(1.0*Units::nanometer, 3.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff3(1.0*Units::nanometer, 3.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos3(-5.0*Units::nanometer, -5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m3( new Geometry::RotateZ_3D(20*Units::degree));
-    PositionParticleInfo particle_info3(new Particle(particle_material, ff3), m3, pos3, 0.5);
+    PositionParticleInfo particle_info3(
+            new Particle(particle_material, ff3, m3), pos3, 0.5);
     particle_decoration.addParticleInfo(particle_info3);
     // add particle number 4:
-    FormFactorBox ff4(1.0*Units::nanometer, 4.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff4(1.0*Units::nanometer, 4.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos4(5.0*Units::nanometer, -5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m4( new Geometry::RotateZ_3D(30*Units::degree));
-    PositionParticleInfo particle_info4(new Particle(particle_material, ff4), m4, pos4, 0.5);
+    PositionParticleInfo particle_info4(
+            new Particle(particle_material, ff4, m4), pos4, 0.5);
     particle_decoration.addParticleInfo(particle_info4);
     // add particle number 5:
-    FormFactorBox ff5(1.0*Units::nanometer, 5.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff5(1.0*Units::nanometer, 5.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos5(-5.0*Units::nanometer, 5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m5( new Geometry::RotateZ_3D(40*Units::degree));
-    PositionParticleInfo particle_info5(new Particle(particle_material, ff5), m5, pos5, 0.5);
+    PositionParticleInfo particle_info5(
+            new Particle(particle_material, ff5, m5), pos5, 0.5);
     particle_decoration.addParticleInfo(particle_info5);
     // add particle number 6:
-    FormFactorBox ff6(1.0*Units::nanometer, 1.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff6(1.0*Units::nanometer, 1.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos6(0.0*Units::nanometer, 0.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m6( new Geometry::RotateZ_3D(50*Units::degree));
-    PositionParticleInfo particle_info6(new Particle(particle_material, ff6), m6, pos6, 0.5);
+    PositionParticleInfo particle_info6(
+            new Particle(particle_material, ff6, m6), pos6, 0.5);
     particle_decoration.addParticleInfo(particle_info6);
     // add particle number 7:
-    FormFactorBox ff7(1.0*Units::nanometer, 2.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff7(1.0*Units::nanometer, 2.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos7(5.0*Units::nanometer, 5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m7( new Geometry::RotateZ_3D(60*Units::degree));
-    PositionParticleInfo particle_info7(new Particle(particle_material, ff7), m7, pos7, 0.5);
+    PositionParticleInfo particle_info7(
+            new Particle(particle_material, ff7, m7), pos7, 0.5);
     particle_decoration.addParticleInfo(particle_info7);
     // add particle number 8:
-    FormFactorBox ff8(1.0*Units::nanometer, 3.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff8(1.0*Units::nanometer, 3.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos8(-5.0*Units::nanometer, -5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m8( new Geometry::RotateZ_3D(70*Units::degree));
-    PositionParticleInfo particle_info8(new Particle(particle_material, ff8), m8, pos8, 0.5);
+    PositionParticleInfo particle_info8(
+            new Particle(particle_material, ff8, m8), pos8, 0.5);
     particle_decoration.addParticleInfo(particle_info8);
     // add particle number 9:
-    FormFactorBox ff9(1.0*Units::nanometer, 4.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff9(1.0*Units::nanometer, 4.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos9(5.0*Units::nanometer, -5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m9( new Geometry::RotateZ_3D(80*Units::degree));
-    PositionParticleInfo particle_info9(new Particle(particle_material, ff9), m9, pos9, 0.5);
+    PositionParticleInfo particle_info9(
+            new Particle(particle_material, ff9, m9), pos9, 0.5);
     particle_decoration.addParticleInfo(particle_info9);
     // add particle number 10:
-    FormFactorBox ff10(1.0*Units::nanometer, 5.0*Units::nanometer,1.0*Units::nanometer);
+    FormFactorBox ff10(1.0*Units::nanometer, 5.0*Units::nanometer,
+            1.0*Units::nanometer);
     kvector_t pos10(-5.0*Units::nanometer, 5.0*Units::nanometer, 0.0);
     Geometry::PTransform3D m10( new Geometry::RotateZ_3D(90*Units::degree));
-    PositionParticleInfo particle_info10(new Particle(particle_material, ff10), m10, pos10, 0.5);
+    PositionParticleInfo particle_info10(
+            new Particle(particle_material, ff10, m10), pos10, 0.5);
     particle_decoration.addParticleInfo(particle_info10);
 
     air_layer.setDecoration(particle_decoration);
diff --git a/Tests/UnitTests/TestCore/ParticleTest.h b/Tests/UnitTests/TestCore/ParticleTest.h
index 2b5dc0496c63c17faf2e40ced3c4ac83a602b3b2..ffa536e1e8806dadf6db69da34eefa0bd2d05bb9 100644
--- a/Tests/UnitTests/TestCore/ParticleTest.h
+++ b/Tests/UnitTests/TestCore/ParticleTest.h
@@ -10,10 +10,9 @@
 
 class ParticleTest : public ::testing::Test
 {
- protected:
+protected:
     ParticleTest(){}
     virtual ~ParticleTest(){}
-
 };
 
 
@@ -24,7 +23,7 @@ TEST_F(ParticleTest, ParticleInitialState)
     EXPECT_EQ(complex_t(0,0), particle.getRefractiveIndex());
     EXPECT_EQ(NULL, particle.getSimpleFormFactor());
     EXPECT_FALSE(particle.hasDistributedFormFactor());
-    EXPECT_EQ(NULL, particle.createFormFactor());
+    EXPECT_EQ(NULL, particle.createFormFactor(1.0));
     ASSERT_THROW(particle.createDistributedParticles(0,0).size(), NullPointerException);
     EXPECT_EQ("Particle", particle.getName());
 
@@ -33,7 +32,7 @@ TEST_F(ParticleTest, ParticleInitialState)
     EXPECT_EQ(complex_t(0,0), particle2->getRefractiveIndex());
     EXPECT_EQ(NULL, particle2->getSimpleFormFactor());
     EXPECT_FALSE(particle2->hasDistributedFormFactor());
-    EXPECT_EQ(NULL, particle2->createFormFactor());
+    EXPECT_EQ(NULL, particle2->createFormFactor(1.0));
     ASSERT_THROW(particle2->createDistributedParticles(0,0).size(), NullPointerException);
     EXPECT_EQ("Particle", particle2->getName());
     delete particle2;
@@ -49,7 +48,7 @@ TEST_F(ParticleTest, ParticleConstructors)
     EXPECT_EQ(complex_t(1,0), p1->getRefractiveIndex());
     EXPECT_EQ(NULL, p1->getSimpleFormFactor());
     EXPECT_FALSE(p1->hasDistributedFormFactor());
-    EXPECT_EQ(NULL, p1->createFormFactor());
+    EXPECT_EQ(NULL, p1->createFormFactor(1.0));
     ASSERT_THROW(p1->createDistributedParticles(0,0).size(), NullPointerException);
     delete p1;
 
@@ -58,11 +57,11 @@ TEST_F(ParticleTest, ParticleConstructors)
     EXPECT_EQ("FormFactorFullSphere", p2->getSimpleFormFactor()->getName());
     EXPECT_EQ(1, p2->getSimpleFormFactor()->getRadius());
     EXPECT_FALSE(p2->hasDistributedFormFactor());
-    EXPECT_TRUE(dynamic_cast<FormFactorDecoratorRefractiveIndex *>(
-            p2->createFormFactor()));
+    EXPECT_TRUE(dynamic_cast<FormFactorDecoratorMaterial *>(
+            p2->createFormFactor(1.0)));
     EXPECT_EQ(complex_t(1,0),
-              dynamic_cast<FormFactorDecoratorRefractiveIndex *>(
-                      p2->createFormFactor())->getAmbientRefractiveIndex());
+              dynamic_cast<FormFactorDecoratorMaterial *>(
+                      p2->createFormFactor(1.0))->getAmbientRefractiveIndex());
     delete p2;
 
     FormFactorFullSphere *sphere3 = new FormFactorFullSphere(1.0);
diff --git a/XCode_BornAgain.xcodeproj/project.pbxproj b/XCode_BornAgain.xcodeproj/project.pbxproj
index 36f367607a843d727377e66ed7759c65463b9595..17c05760e25f9a2264749ee97f3f827bbffa3d7b 100644
--- a/XCode_BornAgain.xcodeproj/project.pbxproj
+++ b/XCode_BornAgain.xcodeproj/project.pbxproj
@@ -117,12 +117,12 @@
 		6223325F17C640A2004CCDAE /* SampleMaterialVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6223325E17C640A2004CCDAE /* SampleMaterialVisitor.cpp */; };
 		6223326617C640C7004CCDAE /* FormFactorDWBAPol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6223326317C640C7004CCDAE /* FormFactorDWBAPol.cpp */; };
 		6223326717C640C7004CCDAE /* FormFactorDWBAPolConstZ.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6223326417C640C7004CCDAE /* FormFactorDWBAPolConstZ.cpp */; };
-		6223326817C640C7004CCDAE /* FormFactorPol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6223326517C640C7004CCDAE /* FormFactorPol.cpp */; };
 		6223326C17C64116004CCDAE /* DecoratedLayerDWBASimulation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6223326917C64116004CCDAE /* DecoratedLayerDWBASimulation.cpp */; };
 		6223326D17C64116004CCDAE /* LayerStrategyBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6223326A17C64116004CCDAE /* LayerStrategyBuilder.cpp */; };
 		6223326E17C64116004CCDAE /* SpecularMagnetic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6223326B17C64116004CCDAE /* SpecularMagnetic.cpp */; };
 		6223327617C641C5004CCDAE /* HomogeneousMagneticMaterial.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6223327417C641C5004CCDAE /* HomogeneousMagneticMaterial.cpp */; };
 		6223327717C641C5004CCDAE /* IMaterial.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6223327517C641C5004CCDAE /* IMaterial.cpp */; };
+		622F80DB17DE1ED20017FC52 /* FormFactorDecoratorMaterial.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 622F80DA17DE1ED20017FC52 /* FormFactorDecoratorMaterial.cpp */; };
 		6236DD0916CE708600ECED4F /* Instrument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6236DD0816CE708600ECED4F /* Instrument.cpp */; };
 		6236DD0D16CE9EC600ECED4F /* Simulation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6236DD0C16CE9EC600ECED4F /* Simulation.cpp */; };
 		6254C2651666652E0098EE7E /* IFormFactorBorn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6254C2641666652E0098EE7E /* IFormFactorBorn.cpp */; };
@@ -269,13 +269,6 @@
 		627F631C17941019009E166F /* libRIO.5.34.so in Frameworks */ = {isa = PBXBuildFile; fileRef = 6222D065160C82CB008205AC /* libRIO.5.34.so */; };
 		627F631D17941019009E166F /* libThread.5.34.so in Frameworks */ = {isa = PBXBuildFile; fileRef = 6222D066160C82CB008205AC /* libThread.5.34.so */; };
 		627F631E17941019009E166F /* libTree.5.34.so in Frameworks */ = {isa = PBXBuildFile; fileRef = 6222D067160C82CB008205AC /* libTree.5.34.so */; };
-		627F64E81794171A009E166F /* Derivator.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 627F64C71794171A009E166F /* Derivator.cxx */; };
-		627F64E91794171A009E166F /* GSLDerivator.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 627F64C81794171A009E166F /* GSLDerivator.cxx */; };
-		627F64EB1794171A009E166F /* GSLMinimizer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 627F64CA1794171A009E166F /* GSLMinimizer.cxx */; };
-		627F64EC1794171A009E166F /* GSLMinimizer1D.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 627F64CB1794171A009E166F /* GSLMinimizer1D.cxx */; };
-		627F64ED1794171A009E166F /* GSLRndmEngines.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 627F64CC1794171A009E166F /* GSLRndmEngines.cxx */; };
-		627F64EE1794171A009E166F /* GSLSimAnnealing.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 627F64CD1794171A009E166F /* GSLSimAnnealing.cxx */; };
-		627F64EF1794171A009E166F /* MultiNumGradFunction.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 627F64CE1794171A009E166F /* MultiNumGradFunction.cxx */; };
 		627F64F1179418FC009E166F /* libMathCore.5.34.so in Frameworks */ = {isa = PBXBuildFile; fileRef = 6222D05C160C82CB008205AC /* libMathCore.5.34.so */; };
 		627F64F217941B35009E166F /* libgsl.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 6222D03F160C690A008205AC /* libgsl.0.dylib */; };
 		627F64F317941BE3009E166F /* libMinuit2.5.34.so in Frameworks */ = {isa = PBXBuildFile; fileRef = 6222D05F160C82CB008205AC /* libMinuit2.5.34.so */; };
@@ -346,6 +339,8 @@
 		627F657617944D37009E166F /* libgsl.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 6222D03F160C690A008205AC /* libgsl.0.dylib */; };
 		627F657717944D37009E166F /* libboost_system.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 6222D03D160C690A008205AC /* libboost_system.dylib */; };
 		627F657817944D37009E166F /* libboost_signals.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 621D0BE816A986CB00134391 /* libboost_signals.dylib */; };
+		628D3C1217E0936400299D2E /* FormFactorDecoratorDebyeWaller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 628D3C1017E0936400299D2E /* FormFactorDecoratorDebyeWaller.cpp */; };
+		628D3C1317E0936400299D2E /* FormFactorDecoratorMultiPositionFactor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 628D3C1117E0936400299D2E /* FormFactorDecoratorMultiPositionFactor.cpp */; };
 		62B316131712FE29004A9D02 /* fp_exception_glibc_extension.c in Sources */ = {isa = PBXBuildFile; fileRef = 62B316111712FE29004A9D02 /* fp_exception_glibc_extension.c */; };
 		62B316141712FE29004A9D02 /* MessageService.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62B316121712FE29004A9D02 /* MessageService.cpp */; };
 		62B3161E1713030F004A9D02 /* libboost_system.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 6222D03D160C690A008205AC /* libboost_system.dylib */; };
@@ -769,7 +764,6 @@
 		62222277160CB745008205AC /* FormFactorDecoratorFactor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormFactorDecoratorFactor.h; sourceTree = "<group>"; };
 		62222278160CB745008205AC /* FormFactorDecoratorMultiPositionFactor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormFactorDecoratorMultiPositionFactor.h; sourceTree = "<group>"; };
 		62222279160CB745008205AC /* FormFactorDecoratorPositionFactor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormFactorDecoratorPositionFactor.h; sourceTree = "<group>"; };
-		6222227A160CB745008205AC /* FormFactorDecoratorRefractiveIndex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormFactorDecoratorRefractiveIndex.h; sourceTree = "<group>"; };
 		6222227B160CB745008205AC /* FormFactorDecoratorTransformation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormFactorDecoratorTransformation.h; sourceTree = "<group>"; };
 		6222227C160CB745008205AC /* FormFactorFullSphere.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormFactorFullSphere.h; sourceTree = "<group>"; };
 		6222227D160CB745008205AC /* FormFactorGauss.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormFactorGauss.h; sourceTree = "<group>"; };
@@ -1441,10 +1435,8 @@
 		6223325E17C640A2004CCDAE /* SampleMaterialVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SampleMaterialVisitor.cpp; sourceTree = "<group>"; };
 		6223326017C640BC004CCDAE /* FormFactorDWBAPol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormFactorDWBAPol.h; sourceTree = "<group>"; };
 		6223326117C640BC004CCDAE /* FormFactorDWBAPolConstZ.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormFactorDWBAPolConstZ.h; sourceTree = "<group>"; };
-		6223326217C640BC004CCDAE /* FormFactorPol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormFactorPol.h; sourceTree = "<group>"; };
 		6223326317C640C7004CCDAE /* FormFactorDWBAPol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormFactorDWBAPol.cpp; sourceTree = "<group>"; };
 		6223326417C640C7004CCDAE /* FormFactorDWBAPolConstZ.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormFactorDWBAPolConstZ.cpp; sourceTree = "<group>"; };
-		6223326517C640C7004CCDAE /* FormFactorPol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormFactorPol.cpp; sourceTree = "<group>"; };
 		6223326917C64116004CCDAE /* DecoratedLayerDWBASimulation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DecoratedLayerDWBASimulation.cpp; sourceTree = "<group>"; };
 		6223326A17C64116004CCDAE /* LayerStrategyBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerStrategyBuilder.cpp; sourceTree = "<group>"; };
 		6223326B17C64116004CCDAE /* SpecularMagnetic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecularMagnetic.cpp; sourceTree = "<group>"; };
@@ -1454,6 +1446,8 @@
 		6223327217C641B9004CCDAE /* HomogeneousMagneticMaterial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomogeneousMagneticMaterial.h; sourceTree = "<group>"; };
 		6223327417C641C5004CCDAE /* HomogeneousMagneticMaterial.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HomogeneousMagneticMaterial.cpp; sourceTree = "<group>"; };
 		6223327517C641C5004CCDAE /* IMaterial.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IMaterial.cpp; sourceTree = "<group>"; };
+		622F80CC17DE1EC50017FC52 /* FormFactorDecoratorMaterial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormFactorDecoratorMaterial.h; sourceTree = "<group>"; };
+		622F80DA17DE1ED20017FC52 /* FormFactorDecoratorMaterial.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormFactorDecoratorMaterial.cpp; sourceTree = "<group>"; };
 		6236DD0716CE707C00ECED4F /* Instrument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Instrument.h; sourceTree = "<group>"; };
 		6236DD0816CE708600ECED4F /* Instrument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Instrument.cpp; sourceTree = "<group>"; };
 		6236DD0A16CE709400ECED4F /* MemberComplexFunctionIntegrator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemberComplexFunctionIntegrator.h; sourceTree = "<group>"; };
@@ -2021,36 +2015,14 @@
 		627F640417941210009E166F /* versiongenerate.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = versiongenerate.py; sourceTree = "<group>"; };
 		627F640517941210009E166F /* gtest.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = gtest.xcodeproj; sourceTree = "<group>"; };
 		627F640817941210009E166F /* gtest.pro */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gtest.pro; sourceTree = "<group>"; };
-		627F64B31794171A009E166F /* RootMathMore.pro */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RootMathMore.pro; sourceTree = "<group>"; };
-		627F64B61794171A009E166F /* Derivator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Derivator.h; sourceTree = "<group>"; };
-		627F64B71794171A009E166F /* GSL1DMinimizerWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSL1DMinimizerWrapper.h; sourceTree = "<group>"; };
-		627F64B81794171A009E166F /* GSLFunctionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLFunctionWrapper.h; sourceTree = "<group>"; };
-		627F64B91794171A009E166F /* GSLMinimizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLMinimizer.h; sourceTree = "<group>"; };
-		627F64BA1794171A009E166F /* GSLMinimizer1D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLMinimizer1D.h; sourceTree = "<group>"; };
-		627F64BB1794171A009E166F /* GSLMultiFit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLMultiFit.h; sourceTree = "<group>"; };
-		627F64BC1794171A009E166F /* GSLMultiFitFunctionAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLMultiFitFunctionAdapter.h; sourceTree = "<group>"; };
-		627F64BD1794171A009E166F /* GSLMultiFitFunctionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLMultiFitFunctionWrapper.h; sourceTree = "<group>"; };
-		627F64BE1794171A009E166F /* GSLMultiMinFunctionAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLMultiMinFunctionAdapter.h; sourceTree = "<group>"; };
-		627F64BF1794171A009E166F /* GSLMultiMinFunctionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLMultiMinFunctionWrapper.h; sourceTree = "<group>"; };
-		627F64C01794171A009E166F /* GSLMultiMinimizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLMultiMinimizer.h; sourceTree = "<group>"; };
-		627F64C11794171A009E166F /* GSLRndmEngines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLRndmEngines.h; sourceTree = "<group>"; };
-		627F64C21794171A009E166F /* GSLRngWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLRngWrapper.h; sourceTree = "<group>"; };
-		627F64C31794171A009E166F /* GSLSimAnnealing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLSimAnnealing.h; sourceTree = "<group>"; };
-		627F64C41794171A009E166F /* MultiNumGradFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiNumGradFunction.h; sourceTree = "<group>"; };
-		627F64C71794171A009E166F /* Derivator.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Derivator.cxx; sourceTree = "<group>"; };
-		627F64C81794171A009E166F /* GSLDerivator.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GSLDerivator.cxx; sourceTree = "<group>"; };
-		627F64CA1794171A009E166F /* GSLMinimizer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GSLMinimizer.cxx; sourceTree = "<group>"; };
-		627F64CB1794171A009E166F /* GSLMinimizer1D.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GSLMinimizer1D.cxx; sourceTree = "<group>"; };
-		627F64CC1794171A009E166F /* GSLRndmEngines.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GSLRndmEngines.cxx; sourceTree = "<group>"; };
-		627F64CD1794171A009E166F /* GSLSimAnnealing.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GSLSimAnnealing.cxx; sourceTree = "<group>"; };
-		627F64CE1794171A009E166F /* MultiNumGradFunction.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiNumGradFunction.cxx; sourceTree = "<group>"; };
-		627F6501179423EA009E166F /* GSLDerivator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GSLDerivator.h; sourceTree = "<group>"; };
 		627F650717942E64009E166F /* libBornAgain.Fit.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libBornAgain.Fit.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
 		627F650817942F41009E166F /* libBornAgain.Core.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libBornAgain.Core.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
 		627F650E17943257009E166F /* libRootMathMore.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libRootMathMore.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
 		627F6552179444B8009E166F /* BornAgain.TestFit01 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BornAgain.TestFit01; sourceTree = BUILT_PRODUCTS_DIR; };
 		627F657C17944D37009E166F /* BornAgain.TestFit02 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BornAgain.TestFit02; sourceTree = BUILT_PRODUCTS_DIR; };
 		62861177167F6C6200971496 /* DetectorParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetectorParameters.h; sourceTree = "<group>"; };
+		628D3C1017E0936400299D2E /* FormFactorDecoratorDebyeWaller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormFactorDecoratorDebyeWaller.cpp; sourceTree = "<group>"; };
+		628D3C1117E0936400299D2E /* FormFactorDecoratorMultiPositionFactor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormFactorDecoratorMultiPositionFactor.cpp; sourceTree = "<group>"; };
 		62AE01631619C72E00A83353 /* ParticleCoreShell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParticleCoreShell.h; sourceTree = "<group>"; };
 		62B3160F1712FE11004A9D02 /* fp_exception_glibc_extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fp_exception_glibc_extension.h; sourceTree = "<group>"; };
 		62B316101712FE11004A9D02 /* MessageService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageService.h; sourceTree = "<group>"; };
@@ -2744,9 +2716,9 @@
 		62222271160CB745008205AC /* inc */ = {
 			isa = PBXGroup;
 			children = (
+				622F80CC17DE1EC50017FC52 /* FormFactorDecoratorMaterial.h */,
 				6223326017C640BC004CCDAE /* FormFactorDWBAPol.h */,
 				6223326117C640BC004CCDAE /* FormFactorDWBAPolConstZ.h */,
-				6223326217C640BC004CCDAE /* FormFactorPol.h */,
 				627F60031793FADB009E166F /* FormFactorTethraedron.h */,
 				625A173B16BAAE69004943DB /* FormFactorCone.h */,
 				625A173C16BAAE69004943DB /* FormFactorFullSpheroid.h */,
@@ -2767,7 +2739,6 @@
 				62222277160CB745008205AC /* FormFactorDecoratorFactor.h */,
 				62222278160CB745008205AC /* FormFactorDecoratorMultiPositionFactor.h */,
 				62222279160CB745008205AC /* FormFactorDecoratorPositionFactor.h */,
-				6222227A160CB745008205AC /* FormFactorDecoratorRefractiveIndex.h */,
 				6222227B160CB745008205AC /* FormFactorDecoratorTransformation.h */,
 				6222227C160CB745008205AC /* FormFactorFullSphere.h */,
 				6222227D160CB745008205AC /* FormFactorGauss.h */,
@@ -2785,9 +2756,11 @@
 		62222285160CB745008205AC /* src */ = {
 			isa = PBXGroup;
 			children = (
+				628D3C1017E0936400299D2E /* FormFactorDecoratorDebyeWaller.cpp */,
+				628D3C1117E0936400299D2E /* FormFactorDecoratorMultiPositionFactor.cpp */,
+				622F80DA17DE1ED20017FC52 /* FormFactorDecoratorMaterial.cpp */,
 				6223326317C640C7004CCDAE /* FormFactorDWBAPol.cpp */,
 				6223326417C640C7004CCDAE /* FormFactorDWBAPolConstZ.cpp */,
-				6223326517C640C7004CCDAE /* FormFactorPol.cpp */,
 				627F60041793FAE3009E166F /* FormFactorTethraedron.cpp */,
 				625A173E16BAAE77004943DB /* FormFactorCone.cpp */,
 				625A173F16BAAE77004943DB /* FormFactorFullSpheroid.cpp */,
@@ -69756,7 +69729,6 @@
 		622245E9160CB74C008205AC /* ThirdParty */ = {
 			isa = PBXGroup;
 			children = (
-				627F649A1794171A009E166F /* RootMathMore */,
 				627F63211794120F009E166F /* gtest */,
 			);
 			path = ThirdParty;
@@ -70635,53 +70607,6 @@
 			name = Products;
 			sourceTree = "<group>";
 		};
-		627F649A1794171A009E166F /* RootMathMore */ = {
-			isa = PBXGroup;
-			children = (
-				627F64B31794171A009E166F /* RootMathMore.pro */,
-				627F64B51794171A009E166F /* inc */,
-				627F64C61794171A009E166F /* src */,
-			);
-			path = RootMathMore;
-			sourceTree = "<group>";
-		};
-		627F64B51794171A009E166F /* inc */ = {
-			isa = PBXGroup;
-			children = (
-				627F6501179423EA009E166F /* GSLDerivator.h */,
-				627F64B61794171A009E166F /* Derivator.h */,
-				627F64B71794171A009E166F /* GSL1DMinimizerWrapper.h */,
-				627F64B81794171A009E166F /* GSLFunctionWrapper.h */,
-				627F64B91794171A009E166F /* GSLMinimizer.h */,
-				627F64BA1794171A009E166F /* GSLMinimizer1D.h */,
-				627F64BB1794171A009E166F /* GSLMultiFit.h */,
-				627F64BC1794171A009E166F /* GSLMultiFitFunctionAdapter.h */,
-				627F64BD1794171A009E166F /* GSLMultiFitFunctionWrapper.h */,
-				627F64BE1794171A009E166F /* GSLMultiMinFunctionAdapter.h */,
-				627F64BF1794171A009E166F /* GSLMultiMinFunctionWrapper.h */,
-				627F64C01794171A009E166F /* GSLMultiMinimizer.h */,
-				627F64C11794171A009E166F /* GSLRndmEngines.h */,
-				627F64C21794171A009E166F /* GSLRngWrapper.h */,
-				627F64C31794171A009E166F /* GSLSimAnnealing.h */,
-				627F64C41794171A009E166F /* MultiNumGradFunction.h */,
-			);
-			path = inc;
-			sourceTree = "<group>";
-		};
-		627F64C61794171A009E166F /* src */ = {
-			isa = PBXGroup;
-			children = (
-				627F64C71794171A009E166F /* Derivator.cxx */,
-				627F64C81794171A009E166F /* GSLDerivator.cxx */,
-				627F64CA1794171A009E166F /* GSLMinimizer.cxx */,
-				627F64CB1794171A009E166F /* GSLMinimizer1D.cxx */,
-				627F64CC1794171A009E166F /* GSLRndmEngines.cxx */,
-				627F64CD1794171A009E166F /* GSLSimAnnealing.cxx */,
-				627F64CE1794171A009E166F /* MultiNumGradFunction.cxx */,
-			);
-			path = src;
-			sourceTree = "<group>";
-		};
 		62B3162E17130E4F004A9D02 /* Fit */ = {
 			isa = PBXGroup;
 			children = (
@@ -71088,7 +71013,7 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "PATH=/opt/local/bin:${PATH}\ncd ${SRCROOT}/Core\nqmake\nmake\ncd ${SRCROOT}/ThirdParty/RootMathMore\nqmake\nmake\ncd ${SRCROOT}/Fit\nqmake\nmake\ncd ${SRCROOT}/App\nqmake\nmake";
+			shellScript = "PATH=/opt/local/bin:${PATH}\ncd ${SRCROOT}/Core\nqmake\nmake\ncd ${SRCROOT}/Fit\nqmake\nmake\ncd ${SRCROOT}/App\nqmake\nmake";
 		};
 		6222D09B160C8EF0008205AC /* ShellScript */ = {
 			isa = PBXShellScriptBuildPhase;
@@ -71372,7 +71297,6 @@
 				6223325F17C640A2004CCDAE /* SampleMaterialVisitor.cpp in Sources */,
 				6223326617C640C7004CCDAE /* FormFactorDWBAPol.cpp in Sources */,
 				6223326717C640C7004CCDAE /* FormFactorDWBAPolConstZ.cpp in Sources */,
-				6223326817C640C7004CCDAE /* FormFactorPol.cpp in Sources */,
 				6223326C17C64116004CCDAE /* DecoratedLayerDWBASimulation.cpp in Sources */,
 				6223326D17C64116004CCDAE /* LayerStrategyBuilder.cpp in Sources */,
 				6223326E17C64116004CCDAE /* SpecularMagnetic.cpp in Sources */,
@@ -71380,6 +71304,9 @@
 				6223327717C641C5004CCDAE /* IMaterial.cpp in Sources */,
 				62D4124917D4E7A900BD34D1 /* LayerSpecularInfo.cpp in Sources */,
 				62D4124A17D4E7A900BD34D1 /* MatrixRTCoefficients.cpp in Sources */,
+				622F80DB17DE1ED20017FC52 /* FormFactorDecoratorMaterial.cpp in Sources */,
+				628D3C1217E0936400299D2E /* FormFactorDecoratorDebyeWaller.cpp in Sources */,
+				628D3C1317E0936400299D2E /* FormFactorDecoratorMultiPositionFactor.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -71408,13 +71335,6 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				627F64E81794171A009E166F /* Derivator.cxx in Sources */,
-				627F64E91794171A009E166F /* GSLDerivator.cxx in Sources */,
-				627F64EB1794171A009E166F /* GSLMinimizer.cxx in Sources */,
-				627F64EC1794171A009E166F /* GSLMinimizer1D.cxx in Sources */,
-				627F64ED1794171A009E166F /* GSLRndmEngines.cxx in Sources */,
-				627F64EE1794171A009E166F /* GSLSimAnnealing.cxx in Sources */,
-				627F64EF1794171A009E166F /* MultiNumGradFunction.cxx in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};