diff --git a/core/src/export_helper.hh b/core/src/export_helper.hh
index 8552ab87d237daa279974f1591731e120a26da97..3142d73d089ffa20ad1cfbf86e259756bbb31e0c 100644
--- a/core/src/export_helper.hh
+++ b/core/src/export_helper.hh
@@ -11,10 +11,24 @@ namespace promod3 { namespace core {
 
 // GT-NOTE: none of those functions were checked for efficiency!
 
+template <typename Iterator>
+void AppendToList(Iterator first, Iterator last, boost::python::list& l) {
+  for (Iterator i = first; i != last; ++i) {
+    l.append(*i);
+  }
+}
+
 template <typename Vec>
 void AppendVectorToList(const Vec& v, boost::python::list& l) {
-  for (typename Vec::const_iterator i = v.begin(); i != v.end(); ++i) {
-    l.append(*i);
+  AppendToList(v.begin(), v.end(), l);
+}
+
+template <typename T1, typename T2>
+void AppendVectorToList(const std::vector<std::pair<T1, T2> >& v,
+                        boost::python::list& l) {
+  typedef typename std::vector<std::pair<T1, T2> >::const_iterator Iterator;
+  for (Iterator i = v.begin(); i != v.end(); ++i) {
+    l.append(boost::python::make_tuple(i->first,i->second));
   }
 }
 
@@ -28,6 +42,14 @@ void ConvertListToVector(const boost::python::list& l, std::vector<T>& v) {
   }
 }
 
+template <typename T>
+void ConvertListToCArray(const boost::python::list& l, T* v) {
+  const int N = boost::python::len(l);
+  for (int i = 0; i < N; ++i) {
+    v[i] = boost::python::extract<T>(l[i]);
+  }
+}
+
 template <typename K, typename V>
 void ConvertDictToMap(const boost::python::dict& d, std::map<K,V>& m) {
   m.clear();
diff --git a/loop/pymod/export_backbone.cc b/loop/pymod/export_backbone.cc
index 8b52d94456e9abfcd6410f22b745b8418ad76b1e..f87d33a41f347502318ce0a366170c5bf489e0f1 100644
--- a/loop/pymod/export_backbone.cc
+++ b/loop/pymod/export_backbone.cc
@@ -53,9 +53,7 @@ BackboneListPtr FullInitWrapper(const String& sequence, boost::python::list l) {
     return p;
   } else {
     ost::mol::ResidueHandleList residues;
-    for(uint i = 0; i < boost::python::len(l); ++i){
-      residues.push_back(boost::python::extract<ost::mol::ResidueHandle>(l[i]));
-    }
+    core::ConvertListToVector(l, residues);
     BackboneListPtr p(new BackboneList(sequence,residues));
     return p;    
   }
diff --git a/loop/pymod/export_psipred_prediction.cc b/loop/pymod/export_psipred_prediction.cc
index 25b892f4604d5e2694fb7b43729b4dae34554d9a..69535c01687531474c0f50839136a7026d7f3024 100644
--- a/loop/pymod/export_psipred_prediction.cc
+++ b/loop/pymod/export_psipred_prediction.cc
@@ -10,7 +10,7 @@ using namespace promod3::loop;
 using namespace boost::python;
 
 
-namespace{
+namespace {
 
   PsipredPredictionPtr WrapEmtpyConstructor(){
     PsipredPredictionPtr p(new PsipredPrediction);
@@ -22,8 +22,8 @@ namespace{
     
     std::vector<char> v_prediction;
     std::vector<int> v_confidence;
-    promod3::core::ConvertListToVector(prediction, v_prediction);
-    promod3::core::ConvertListToVector(confidence, v_confidence);
+    core::ConvertListToVector(prediction, v_prediction);
+    core::ConvertListToVector(confidence, v_confidence);
     PsipredPredictionPtr p(new PsipredPrediction(v_prediction,v_confidence));
     return p;
   }
diff --git a/loop/pymod/export_structure_db.cc b/loop/pymod/export_structure_db.cc
index 3db55bbb02dd8cee425381ef3eae3c5f9b4fa2c1..569398cecd46e406a9e93859762277436a985726 100644
--- a/loop/pymod/export_structure_db.cc
+++ b/loop/pymod/export_structure_db.cc
@@ -9,7 +9,7 @@ using namespace promod3::loop;
 using namespace boost::python;
 
 
-namespace{
+namespace {
 
   BackboneList wrap_get_bb_list_one(StructureDBPtr db, const FragmentInfo& info){
     BackboneList bb_list;
@@ -43,11 +43,7 @@ namespace{
 
     std::vector<std::pair<Real,Real> > dihedrals = db->GetDihedralAngles(info);
     boost::python::list return_list;
-
-    for(std::vector<std::pair<Real,Real> >::iterator i = dihedrals.begin();
-        i != dihedrals.end(); ++i){
-      return_list.append(boost::python::make_tuple(i->first,i->second));
-    }
+    core::AppendVectorToList(dihedrals, return_list);
     return return_list;
   }
 
diff --git a/loop/pymod/export_torsion_sampler.cc b/loop/pymod/export_torsion_sampler.cc
index 26a95f53b1f8d5ac13c25372633cebe51d0d95d1..286a70302f7be6f0c4ad3f350b078db0fb39fb6f 100644
--- a/loop/pymod/export_torsion_sampler.cc
+++ b/loop/pymod/export_torsion_sampler.cc
@@ -9,7 +9,7 @@ using namespace promod3;
 using namespace promod3::loop;
 using namespace boost::python;
 
-namespace{
+namespace {
 
   boost::python::tuple WrapDrawNames(TorsionSamplerPtr p, 
                                      ost::conop::AminoAcid before, 
@@ -82,13 +82,15 @@ namespace{
     return p->GetPsiProbabilityGivenPhi(before,central,after,psi,phi);
   }
 
-  TorsionSamplerPtr WrapInit(list group_definitions, int bin_size, int seed){
+  TorsionSamplerPtr WrapInit(list group_definitions, int bin_size, int seed) {
     std::vector<String> v_group_definitions;
     core::ConvertListToVector(group_definitions, v_group_definitions);
-    return TorsionSamplerPtr(new TorsionSampler(v_group_definitions,bin_size,seed));
+    return TorsionSamplerPtr(new TorsionSampler(v_group_definitions, bin_size,
+                                                seed));
   }
 
-  boost::python::list WrapGetHistogramIndices(TorsionSamplerPtr p, const String& sequence){
+  boost::python::list WrapGetHistogramIndices(TorsionSamplerPtr p,
+                                              const String& sequence) {
     std::vector<uint> indices = p->GetHistogramIndices(sequence);
     boost::python::list ret_list;
     core::AppendVectorToList(indices, ret_list);
diff --git a/modelling/pymod/_pipeline.py b/modelling/pymod/_pipeline.py
index 70c20c5be818a4636e02b3e24b9b2bf8b60b6852..41be587cdaf789d21b889adf908e3ab3339154cc 100644
--- a/modelling/pymod/_pipeline.py
+++ b/modelling/pymod/_pipeline.py
@@ -4,7 +4,7 @@ as argument.
 '''
 
 # internal
-from promod3 import loop, sidechain, core, scoring
+from promod3 import loop, sidechain, core
 from _modelling import *
 from _closegaps import *
 from _ring_punches import *
diff --git a/modelling/pymod/export_gap_extender.cc b/modelling/pymod/export_gap_extender.cc
index b9cf4cbea8ce9cb76d839b098611fa22ebc5f0b2..68c4df77d46120f774b158c8136b5f60b9ce49a3 100644
--- a/modelling/pymod/export_gap_extender.cc
+++ b/modelling/pymod/export_gap_extender.cc
@@ -1,8 +1,10 @@
 #include <boost/python.hpp>
 #include <promod3/modelling/gap_extender.hh>
+#include <promod3/core/export_helper.hh>
 
 using namespace ost;
 using namespace boost::python;
+using namespace promod3;
 using namespace promod3::modelling;
 
 namespace {
@@ -28,15 +30,10 @@ namespace {
                                                      const int max_length=-2)
   {
     std::vector<Real> v_penalties;
-    for(uint i = 0; i < len(penalties); ++i){
-      v_penalties.push_back(extract<Real>(penalties[i]));
-    }
-
+    core::ConvertListToVector(penalties, v_penalties);
     ScoringGapExtenderPtr extender(
       new ScoringGapExtender(gap, extension_penalty, v_penalties,
-                             seqres, max_length)
-      );
-
+                             seqres, max_length));
     return extender;
   }
 
@@ -56,15 +53,10 @@ namespace {
                               const int max_length=-2)
   {
     std::vector<Real> v_penalties;
-    for(uint i = 0; i < len(penalties); ++i){
-      v_penalties.push_back(extract<Real>(penalties[i]));
-    }
-
+    core::ConvertListToVector(penalties, v_penalties);
     ScoringGapExtenderPtr extender(
       new ScoringGapExtender(gap, extension_penalty, v_penalties,
-                             seqres, max_length)
-      );
-
+                             seqres, max_length));
     return extender;
   }
 
diff --git a/scoring/pymod/export_pairwise_functions.cc b/scoring/pymod/export_pairwise_functions.cc
index 9e4e224a553f6ae7167cdab9297da934d0fc40f3..b43f195c41a12ff6c293699127bd54be882de60d 100644
--- a/scoring/pymod/export_pairwise_functions.cc
+++ b/scoring/pymod/export_pairwise_functions.cc
@@ -1,22 +1,18 @@
 #include <boost/python.hpp>
 #include <promod3/scoring/pairwise_scoring_function.hh>
+#include <promod3/core/export_helper.hh>
 
 using namespace promod3;
 using namespace promod3::scoring;
 using namespace boost::python;
 
-namespace{
+namespace {
 
 ConstraintFunctionPtr WrapConstraintInit(Real min, Real max, 
-                                         const boost::python::list& values){
-
+                                         const boost::python::list& values) {
   std::vector<Real> v_values;
-  for(uint i = 0; i < boost::python::len(values); ++i){
-    v_values.push_back(boost::python::extract<Real>(values[i]));
-  }
-
+  core::ConvertListToVector(values, v_values);
   ConstraintFunctionPtr p(new ConstraintFunction(min, max, v_values));
-
   return p;
 }
 
diff --git a/sidechain/pymod/export_frame.cc b/sidechain/pymod/export_frame.cc
index 30736a51a3db92af1344efce88487e04e19d805b..eb0b997121546f03283ae692fc78ad8e82b4a18a 100644
--- a/sidechain/pymod/export_frame.cc
+++ b/sidechain/pymod/export_frame.cc
@@ -4,12 +4,11 @@
 #include <promod3/sidechain/frame_constructor.hh>
 #include <promod3/core/export_helper.hh>
 
-
 using namespace boost::python;
 using namespace promod3::sidechain;
 using namespace promod3;
 
-namespace{
+namespace {
 
 FramePtr WrapFrameInitOne(boost::python::list& frame_residues){
   std::vector<FrameResiduePtr> v_residues;
@@ -18,7 +17,7 @@ FramePtr WrapFrameInitOne(boost::python::list& frame_residues){
 }
 
 FramePtr WrapFrameInitTwo(boost::python::list& frame_residues,
-                       boost::python::list& rt_operators){
+                          boost::python::list& rt_operators){
   std::vector<FrameResiduePtr> v_residues;
   std::vector<geom::Transform> v_rt_operators;
   core::ConvertListToVector(frame_residues, v_residues);
@@ -26,15 +25,13 @@ FramePtr WrapFrameInitTwo(boost::python::list& frame_residues,
   return FramePtr(new Frame(v_residues,v_rt_operators));
 }
 
-FrameResiduePtr WrapFrameResidueInit(boost::python::list& particles, uint residue_index){
+FrameResiduePtr WrapFrameResidueInit(boost::python::list& particles,
+                                     uint residue_index) {
 
   size_t size = boost::python::len(particles);
   Particle* new_particles = new Particle[size];
-
-  for(uint i = 0; i < size; ++i){
-    new_particles[i] = (boost::python::extract<Particle>(particles[i]));
-  }
-  return FrameResiduePtr(new FrameResidue(new_particles,size,residue_index));
+  core::ConvertListToCArray(particles, new_particles);
+  return FrameResiduePtr(new FrameResidue(new_particles, size, residue_index));
 }
 
 ParticlePtr WrapGetItem(FrameResiduePtr p, uint index){
@@ -45,31 +42,36 @@ ParticlePtr WrapGetItem(FrameResiduePtr p, uint index){
   return ret_particle;
 }
 
-FrameResiduePtr ConstructFrameResidue_one(const geom::Vec3& n_pos, const geom::Vec3& ca_pos, 
-                                          const geom::Vec3& c_pos, const geom::Vec3& o_pos,
-                                          const geom::Vec3& cb_pos, RotamerID id, uint residue_index,
+FrameResiduePtr ConstructFrameResidue_one(const geom::Vec3& n_pos,
+                                          const geom::Vec3& ca_pos,
+                                          const geom::Vec3& c_pos,
+                                          const geom::Vec3& o_pos,
+                                          const geom::Vec3& cb_pos,
+                                          RotamerID id, uint residue_index,
                                           RotamerSettingsPtr settings, Real phi,
-                                          bool n_ter, bool c_ter){
-  return ConstructBackboneFrameResidue(n_pos,ca_pos,c_pos,o_pos,cb_pos,id,
-                                       residue_index,settings,phi,n_ter,c_ter);
+                                          bool n_ter, bool c_ter) {
+  return ConstructBackboneFrameResidue(n_pos, ca_pos, c_pos, o_pos, cb_pos, id,
+                                       residue_index, settings, phi, n_ter,
+                                       c_ter);
 }
 
 FrameResiduePtr ConstructFrameResidue_two(const ost::mol::ResidueHandle& res,
                                           RotamerID id, uint residue_index,
                                           RotamerSettingsPtr settings, Real phi,
                                           bool n_ter, bool c_ter){
-  return ConstructBackboneFrameResidue(res,id,residue_index,settings,phi,n_ter,c_ter);
+  return ConstructBackboneFrameResidue(res, id, residue_index, settings, phi,
+                                       n_ter, c_ter);
 }
 
 FrameResiduePtr ConstructFrameResidue_three(const ost::mol::ResidueHandle& res,
                                             RotamerID id, uint residue_index,
                                             RotamerSettingsPtr settings){
-  return ConstructSidechainFrameResidue(res,id,residue_index,settings);
+  return ConstructSidechainFrameResidue(res, id, residue_index, settings);
 }
 
 FrameResiduePtr ConstructFrameResidue_four(const ost::mol::ResidueHandle& res, uint residue_index){
 
-  return ConstructFrameResidue(res,residue_index);
+  return ConstructFrameResidue(res, residue_index);
 }
 
 void SetFrameEnergyOne(FramePtr frame, RRMRotamerGroupPtr p){
diff --git a/sidechain/pymod/export_graph.cc b/sidechain/pymod/export_graph.cc
index 86aa45283bf754d6b634c75428908bc3e571807c..37c0201b5807190494f6cebd2d667d9a7edd08e6 100644
--- a/sidechain/pymod/export_graph.cc
+++ b/sidechain/pymod/export_graph.cc
@@ -7,10 +7,10 @@ using namespace boost::python;
 using namespace promod3::sidechain;
 using namespace promod3;
 
-namespace{
+namespace {
 
 GraphPtr WrapRRMList(boost::python::list& rotamer_groups,
-                     boost::python::list& rt_operators){
+                     boost::python::list& rt_operators) {
   std::vector<RRMRotamerGroupPtr> v_rotamer_groups;
   std::vector<geom::Transform> v_rt_operators;
   core::ConvertListToVector(rotamer_groups, v_rotamer_groups);
@@ -19,7 +19,7 @@ GraphPtr WrapRRMList(boost::python::list& rotamer_groups,
 }
 
 GraphPtr WrapFRMList(boost::python::list& rotamer_groups,
-                     boost::python::list& rt_operators){
+                     boost::python::list& rt_operators) {
   std::vector<FRMRotamerGroupPtr> v_rotamer_groups;
   std::vector<geom::Transform> v_rt_operators;
   core::ConvertListToVector(rotamer_groups, v_rotamer_groups);
@@ -27,7 +27,8 @@ GraphPtr WrapFRMList(boost::python::list& rotamer_groups,
   return Graph::CreateFromFRMList(v_rotamer_groups,v_rt_operators);
 }
 
-boost::python::list WrapSolve(GraphPtr graph, uint64_t max_complexity,Real initial_epsilon){
+boost::python::list WrapSolve(GraphPtr graph, uint64_t max_complexity,
+                              Real initial_epsilon) {
   std::vector<int> solution = graph->Solve(max_complexity,initial_epsilon);
   boost::python::list return_list;
   core::AppendVectorToList(solution, return_list);
diff --git a/sidechain/pymod/export_rotamer.cc b/sidechain/pymod/export_rotamer.cc
index 17b248986327a4278ebcf4ace3616b37632613fe..9b1f10c015b7d0cbf7ffea806a7e833b2312c47d 100644
--- a/sidechain/pymod/export_rotamer.cc
+++ b/sidechain/pymod/export_rotamer.cc
@@ -6,52 +6,49 @@
 #include <promod3/sidechain/rotamer_group.hh>
 #include <promod3/sidechain/rotamer_constructor.hh>
 
-
-
 using namespace boost::python;
 using namespace promod3::sidechain;
 using namespace promod3;
 
-namespace{
+namespace {
 
-RRMRotamerGroupPtr WrapRRMRotamerGroupInit(const boost::python::list& rotamers, uint residue_index){
+RRMRotamerGroupPtr WrapRRMRotamerGroupInit(const boost::python::list& rotamers,
+                                           uint residue_index) {
   std::vector<RRMRotamerPtr> v_rotamers;
   core::ConvertListToVector(rotamers, v_rotamers);
   return RRMRotamerGroupPtr(new RRMRotamerGroup(v_rotamers,residue_index));
 }
 
-FRMRotamerGroupPtr WrapFRMRotamerGroupInit(const boost::python::list& rotamers, uint residue_index){
+FRMRotamerGroupPtr WrapFRMRotamerGroupInit(const boost::python::list& rotamers,
+                                           uint residue_index) {
   std::vector<FRMRotamerPtr> v_rotamers;
   core::ConvertListToVector(rotamers, v_rotamers);
   return FRMRotamerGroupPtr(new FRMRotamerGroup(v_rotamers,residue_index));
 }
 
-Particle WrapRRMGetItem(RRMRotamerPtr p, uint index){
-  if(index >= p->size()){
+Particle WrapRRMGetItem(RRMRotamerPtr p, uint index) {
+  if (index >= p->size()) {
     throw promod3::Error("Invalid particle index!");
   }
   return *(*p)[index];
 }
 
-Particle WrapFRMGetItem(FRMRotamerPtr p, uint index){
-  if(index >= p->size()){
+Particle WrapFRMGetItem(FRMRotamerPtr p, uint index) {
+  if (index >= p->size()) {
     throw promod3::Error("Invalid particle index!");
   }
   return *(*p)[index];
 }
 
-boost::python::list WrapGetSubrotamerDefinition(FRMRotamerPtr p,uint subrotamer_index){
-
-  if(subrotamer_index >= p->subrotamer_size()){
+boost::python::list WrapGetSubrotamerDefinition(FRMRotamerPtr p,
+                                                uint subrotamer_index) {
+  if (subrotamer_index >= p->subrotamer_size()) {
     throw promod3::Error("Invalid subrotamer index observed!");
   }
 
   boost::python::list return_list;
-
   FRMRotamer::subrotamer_iterator i = p->subrotamers_begin() + subrotamer_index;
-  for(std::vector<int>::iterator j = i->begin(); j != i->end(); ++j){
-    return_list.append(*j);
-  }
+  core::AppendToList(i->begin(), i->end(), return_list);
   return return_list;
 }
 
@@ -60,158 +57,165 @@ boost::python::list WrapGetSubrotamerAssociations(FRMRotamerPtr p, uint particle
     throw promod3::Error("Invalid particle index!");
   }
   boost::python::list return_list;
-  for(FRMRotamer::subrotamer_association_iterator i = p->subrotamer_association_begin(particle_index);
-      i != p->subrotamer_association_end(particle_index); ++i){
-    return_list.append(*i);
-  }
+  core::AppendToList(p->subrotamer_association_begin(particle_index),
+                     p->subrotamer_association_end(particle_index),
+                     return_list);
   return return_list;
 }
 
-RRMRotamerPtr ConstructRRMRotamer_one(const geom::Vec3& n_pos, const geom::Vec3& ca_pos, 
-                                      const geom::Vec3& cb_pos, RotamerID id, uint,
+RRMRotamerPtr ConstructRRMRotamer_one(const geom::Vec3& n_pos,
+                                      const geom::Vec3& ca_pos,
+                                      const geom::Vec3& cb_pos, RotamerID id,
                                       RotamerSettingsPtr settings,
-                                      Real probability, Real chi1, Real chi2, Real chi3, Real chi4){
-  return ConstructRRMRotamer(n_pos,ca_pos,cb_pos,id,settings,probability,
-                             chi1,chi2,chi3,chi4);
+                                      Real probability, Real chi1, Real chi2,
+                                      Real chi3, Real chi4) {
+  return ConstructRRMRotamer(n_pos, ca_pos, cb_pos, id, settings, probability,
+                             chi1, chi2, chi3, chi4);
 }
 
-RRMRotamerPtr ConstructRRMRotamer_two(const ost::mol::ResidueHandle& res, RotamerID id, uint,
-                                      RotamerSettingsPtr settings,
-                                      Real probability, Real chi1, Real chi2, Real chi3, Real chi4){
-  return ConstructRRMRotamer(res,id,settings,probability,
-                             chi1,chi2,chi3,chi4);
+RRMRotamerPtr ConstructRRMRotamer_two(const ost::mol::ResidueHandle& res,
+                                      RotamerID id, RotamerSettingsPtr settings,
+                                      Real probability, Real chi1, Real chi2,
+                                      Real chi3, Real chi4) {
+  return ConstructRRMRotamer(res, id, settings, probability,
+                             chi1, chi2, chi3, chi4);
 }
 
 
-FRMRotamerPtr ConstructFRMRotamer_one(const geom::Vec3& n_pos, const geom::Vec3& ca_pos, 
-                                      const geom::Vec3& cb_pos, RotamerID id, uint,
+FRMRotamerPtr ConstructFRMRotamer_one(const geom::Vec3& n_pos,
+                                      const geom::Vec3& ca_pos,
+                                      const geom::Vec3& cb_pos, RotamerID id,
                                       RotamerSettingsPtr settings,
-                                      Real probability, Real chi1, Real sig1, Real chi2, Real sig2, 
-                                      Real chi3, Real sig3, Real chi4, Real sig4){
-  return ConstructFRMRotamer(n_pos,ca_pos,cb_pos,id,settings,probability,
-                             chi1,sig1,chi2,sig2,chi3,sig3,chi4,sig4);
+                                      Real probability, Real chi1, Real sig1,
+                                      Real chi2, Real sig2, Real chi3,
+                                      Real sig3, Real chi4, Real sig4) {
+  return ConstructFRMRotamer(n_pos, ca_pos, cb_pos, id, settings, probability,
+                             chi1, sig1, chi2, sig2, chi3, sig3, chi4, sig4);
 }
 
-FRMRotamerPtr ConstructFRMRotamer_two(const ost::mol::ResidueHandle& res, RotamerID id, uint,
-                                      RotamerSettingsPtr settings,
-                                      Real probability, Real chi1, Real sig1, Real chi2, Real sig2, 
-                                      Real chi3, Real sig3, Real chi4, Real sig4){
-  return ConstructFRMRotamer(res,id,settings,probability,
-                             chi1,sig1,chi2,sig2,chi3,sig3,chi4,sig4);
+FRMRotamerPtr ConstructFRMRotamer_two(const ost::mol::ResidueHandle& res,
+                                      RotamerID id, RotamerSettingsPtr settings,
+                                      Real probability, Real chi1, Real sig1,
+                                      Real chi2, Real sig2, Real chi3,
+                                      Real sig3, Real chi4, Real sig4) {
+  return ConstructFRMRotamer(res, id, settings, probability, 
+                             chi1, sig1, chi2, sig2, chi3, sig3, chi4, sig4);
 }
 
-RRMRotamerGroupPtr ConstructRRMRotamerGroup_one(const geom::Vec3& n_pos, const geom::Vec3& ca_pos, 
-                                                 const geom::Vec3& cb_pos, RotamerID id, uint residue_index,
-                                                 BBDepRotamerLibPtr rot_lib,
-                                                 RotamerSettingsPtr settings,
-                                                 Real phi, Real psi){
-    return ConstructRRMRotamerGroup(n_pos,ca_pos,cb_pos,id,residue_index,rot_lib,settings,phi,psi);
+RRMRotamerGroupPtr ConstructRRMRotamerGroup_one(
+                        const geom::Vec3& n_pos, const geom::Vec3& ca_pos,
+                        const geom::Vec3& cb_pos, RotamerID id,
+                        uint residue_index, BBDepRotamerLibPtr rot_lib,
+                        RotamerSettingsPtr settings, Real phi, Real psi) {
+  return ConstructRRMRotamerGroup(n_pos, ca_pos, cb_pos, id, residue_index,
+                                  rot_lib, settings, phi, psi);
 }
 
-RRMRotamerGroupPtr ConstructRRMRotamerGroup_two(const ost::mol::ResidueHandle& res, 
-                                                RotamerID id, uint residue_index,
-                                                BBDepRotamerLibPtr rot_lib,
-                                                RotamerSettingsPtr settings,
-                                                Real phi, Real psi){
-    return ConstructRRMRotamerGroup(res,id,residue_index,rot_lib,settings,phi,psi);
+RRMRotamerGroupPtr ConstructRRMRotamerGroup_two(
+                        const ost::mol::ResidueHandle& res, RotamerID id,
+                        uint residue_index, BBDepRotamerLibPtr rot_lib,
+                        RotamerSettingsPtr settings, Real phi, Real psi) {
+  return ConstructRRMRotamerGroup(res, id, residue_index, rot_lib, settings,
+                                  phi, psi);
 }
 
-RRMRotamerGroupPtr ConstructRRMRotamerGroup_three(const ost::mol::ResidueHandle& res, 
-                                                  uint residue_index,
-                                                  BBDepRotamerLibPtr rot_lib,
-                                                  RotamerSettingsPtr settings,
-                                                  Real phi, Real psi){
-    return ConstructRRMRotamerGroup(res,residue_index,rot_lib,settings,phi,psi);
+RRMRotamerGroupPtr ConstructRRMRotamerGroup_three(
+                        const ost::mol::ResidueHandle& res, uint residue_index,
+                        BBDepRotamerLibPtr rot_lib, RotamerSettingsPtr settings,
+                        Real phi, Real psi) {
+  return ConstructRRMRotamerGroup(res, residue_index, rot_lib, settings,
+                                  phi, psi);
 }
 
-FRMRotamerGroupPtr ConstructFRMRotamerGroup_one(const geom::Vec3& n_pos, const geom::Vec3& ca_pos, 
-                                                const geom::Vec3& cb_pos, RotamerID id, uint residue_index,
-                                                BBDepRotamerLibPtr rot_lib,
-                                                RotamerSettingsPtr settings,
-                                                Real phi, Real psi){
-    return ConstructFRMRotamerGroup(n_pos,ca_pos,cb_pos,id,residue_index,rot_lib,settings,phi,psi);
+FRMRotamerGroupPtr ConstructFRMRotamerGroup_one(
+                        const geom::Vec3& n_pos, const geom::Vec3& ca_pos,
+                        const geom::Vec3& cb_pos, RotamerID id,
+                        uint residue_index, BBDepRotamerLibPtr rot_lib,
+                        RotamerSettingsPtr settings, Real phi, Real psi) {
+  return ConstructFRMRotamerGroup(n_pos, ca_pos, cb_pos, id, residue_index,
+                                  rot_lib, settings, phi, psi);
 }
 
-FRMRotamerGroupPtr ConstructFRMRotamerGroup_two(const ost::mol::ResidueHandle& res, 
-                                                RotamerID id, uint residue_index,
-                                                BBDepRotamerLibPtr rot_lib,
-                                                RotamerSettingsPtr settings,
-                                                Real phi, Real psi){
-    return ConstructFRMRotamerGroup(res,id,residue_index,rot_lib,settings,phi,psi);
+FRMRotamerGroupPtr ConstructFRMRotamerGroup_two(
+                        const ost::mol::ResidueHandle& res, RotamerID id,
+                        uint residue_index, BBDepRotamerLibPtr rot_lib,
+                        RotamerSettingsPtr settings, Real phi, Real psi) {
+  return ConstructFRMRotamerGroup(res, id, residue_index, rot_lib, settings,
+                                  phi, psi);
 }
 
-FRMRotamerGroupPtr ConstructFRMRotamerGroup_three(const ost::mol::ResidueHandle& res, 
-                                                  uint residue_index,
-                                                  BBDepRotamerLibPtr rot_lib,
-                                                  RotamerSettingsPtr settings,
-                                                  Real phi, Real psi){
-    return ConstructFRMRotamerGroup(res,residue_index,rot_lib,settings,phi,psi);
+FRMRotamerGroupPtr ConstructFRMRotamerGroup_three(
+                        const ost::mol::ResidueHandle& res, uint residue_index,
+                        BBDepRotamerLibPtr rot_lib, RotamerSettingsPtr settings,
+                        Real phi, Real psi) {
+  return ConstructFRMRotamerGroup(res, residue_index, rot_lib, settings,
+                                  phi, psi);
 }
 
 
-
-
-RRMRotamerGroupPtr ConstructRRMRotamerGroupNoBB_one(const geom::Vec3& n_pos, const geom::Vec3& ca_pos, 
-                                                    const geom::Vec3& cb_pos, RotamerID id, uint residue_index,
-                                                    RotamerLibPtr rot_lib,
-                                                    RotamerSettingsPtr settings){
-    return ConstructRRMRotamerGroup(n_pos,ca_pos,cb_pos,id,residue_index,rot_lib,settings);
+RRMRotamerGroupPtr ConstructRRMRotamerGroupNoBB_one(
+                        const geom::Vec3& n_pos, const geom::Vec3& ca_pos,
+                        const geom::Vec3& cb_pos, RotamerID id,
+                        uint residue_index, RotamerLibPtr rot_lib,
+                        RotamerSettingsPtr settings) {
+  return ConstructRRMRotamerGroup(n_pos, ca_pos, cb_pos, id, residue_index,
+                                  rot_lib, settings);
 }
 
-RRMRotamerGroupPtr ConstructRRMRotamerGroupNoBB_two(const ost::mol::ResidueHandle& res, 
-                                                    RotamerID id, uint residue_index,
-                                                    RotamerLibPtr rot_lib,
-                                                    RotamerSettingsPtr settings){
-    return ConstructRRMRotamerGroup(res,id,residue_index,rot_lib,settings);
+RRMRotamerGroupPtr ConstructRRMRotamerGroupNoBB_two(
+                        const ost::mol::ResidueHandle& res, RotamerID id,
+                        uint residue_index, RotamerLibPtr rot_lib,
+                        RotamerSettingsPtr settings) {
+  return ConstructRRMRotamerGroup(res, id, residue_index, rot_lib, settings);
 }
 
-RRMRotamerGroupPtr ConstructRRMRotamerGroupNoBB_three(const ost::mol::ResidueHandle& res, 
-                                                      uint residue_index,
-                                                      RotamerLibPtr rot_lib,
-                                                      RotamerSettingsPtr settings){
-    return ConstructRRMRotamerGroup(res,residue_index,rot_lib,settings);
+RRMRotamerGroupPtr ConstructRRMRotamerGroupNoBB_three(
+                        const ost::mol::ResidueHandle& res, uint residue_index,
+                        RotamerLibPtr rot_lib, RotamerSettingsPtr settings) {
+  return ConstructRRMRotamerGroup(res, residue_index, rot_lib, settings);
 }
 
-FRMRotamerGroupPtr ConstructFRMRotamerGroupNoBB_one(const geom::Vec3& n_pos, const geom::Vec3& ca_pos, 
-                                                    const geom::Vec3& cb_pos, RotamerID id, uint residue_index,
-                                                    RotamerLibPtr rot_lib,
-                                                    RotamerSettingsPtr settings){
-    return ConstructFRMRotamerGroup(n_pos,ca_pos,cb_pos,id,residue_index,rot_lib,settings);
+FRMRotamerGroupPtr ConstructFRMRotamerGroupNoBB_one(
+                        const geom::Vec3& n_pos, const geom::Vec3& ca_pos,
+                        const geom::Vec3& cb_pos, RotamerID id,
+                        uint residue_index, RotamerLibPtr rot_lib,
+                        RotamerSettingsPtr settings) {
+  return ConstructFRMRotamerGroup(n_pos, ca_pos, cb_pos, id, residue_index,
+                                  rot_lib, settings);
 }
 
-FRMRotamerGroupPtr ConstructFRMRotamerGroupNoBB_two(const ost::mol::ResidueHandle& res, 
-                                                    RotamerID id, uint residue_index,
-                                                    RotamerLibPtr rot_lib,
-                                                    RotamerSettingsPtr settings){
-    return ConstructFRMRotamerGroup(res,id,residue_index,rot_lib,settings);
+FRMRotamerGroupPtr ConstructFRMRotamerGroupNoBB_two(
+                        const ost::mol::ResidueHandle& res, RotamerID id,
+                        uint residue_index, RotamerLibPtr rot_lib,
+                        RotamerSettingsPtr settings) {
+  return ConstructFRMRotamerGroup(res, id, residue_index, rot_lib, settings);
 }
 
-FRMRotamerGroupPtr ConstructFRMRotamerGroupNoBB_three(const ost::mol::ResidueHandle& res, 
-                                                      uint residue_index,
-                                                      RotamerLibPtr rot_lib,
-                                                      RotamerSettingsPtr settings){
-    return ConstructFRMRotamerGroup(res,residue_index,rot_lib,settings);
+FRMRotamerGroupPtr ConstructFRMRotamerGroupNoBB_three(
+                        const ost::mol::ResidueHandle& res,
+                        uint residue_index, RotamerLibPtr rot_lib,
+                        RotamerSettingsPtr settings) {
+  return ConstructFRMRotamerGroup(res, residue_index, rot_lib, settings);
 }
 
 
-
-Real GetFRMFrameEnergyOne(FRMRotamerPtr p){
+Real GetFRMFrameEnergyOne(FRMRotamerPtr p) {
   return p->GetFrameEnergy();
 }
 
-Real GetFRMFrameEnergyTwo(FRMRotamerPtr p, uint index){
-  if(index >= p->subrotamer_size()){
+Real GetFRMFrameEnergyTwo(FRMRotamerPtr p, uint index) {
+  if (index >= p->subrotamer_size()) {
     throw promod3::Error("Invalid subrotamer index");
   }
   return p->GetFrameEnergy(index);
 }
 
-void SetFRMFrameEnergyOne(FRMRotamerPtr p, Real e){
+void SetFRMFrameEnergyOne(FRMRotamerPtr p, Real e) {
   p->SetFrameEnergy(e);
 }
 
-void SetFRMFrameEnergyTwo(FRMRotamerPtr p, Real e, uint index){
-  if(index >= p->subrotamer_size()){
+void SetFRMFrameEnergyTwo(FRMRotamerPtr p, Real e, uint index) {
+  if (index >= p->subrotamer_size()) {
     throw promod3::Error("Invalid subrotamer index");
   }
   p->SetFrameEnergy(e,index);
@@ -225,7 +229,8 @@ void export_Rotamer()
   class_<RRMRotamer>("RRMRotamer", no_init)
     .def("__len__",&RRMRotamer::size)
     .def("__getitem__",&WrapRRMGetItem,arg("index"))
-    .def("ApplyOnResidue", &RRMRotamer::ApplyOnResidue,(arg("res"),arg("consider_hydrogens")=false,arg("new_res_name")=""))
+    .def("ApplyOnResidue", &RRMRotamer::ApplyOnResidue,
+         (arg("res"), arg("consider_hydrogens")=false, arg("new_res_name")=""))
     .def("GetTransformedCopy",&RRMRotamer::GetTransformedCopy,(arg("transform")))
     .def("CalculateInternalEnergy", &RRMRotamer::CalculateInternalEnergy,(arg("normalization_factor")))
     .def("GetInternalEnergy",&RRMRotamer::GetInternalEnergy)
@@ -233,8 +238,10 @@ void export_Rotamer()
     .def("GetFrameEnergy",&RRMRotamer::GetFrameEnergy)
     .def("GetSelfEnergy",&RRMRotamer::GetSelfEnergy)
     .def("GetProbability",&RRMRotamer::GetProbability)
-    .def("SetInternalEnergy",&RRMRotamer::SetInternalEnergy,(arg("internal_energy")))
-    .def("SetInternalEnergyPrefactor",&RRMRotamer::SetInternalEnergyPrefactor,(arg("prefactor")))
+    .def("SetInternalEnergy",&RRMRotamer::SetInternalEnergy,
+         (arg("internal_energy")))
+    .def("SetInternalEnergyPrefactor",&RRMRotamer::SetInternalEnergyPrefactor,
+         (arg("prefactor")))
     .def("SetFrameEnergy",&RRMRotamer::SetFrameEnergy,(arg("frame_energy")))
     .def("SetProbability",&RRMRotamer::SetProbability,(arg("probability")))
   ; 
@@ -248,7 +255,8 @@ void export_Rotamer()
     .def("GetNumSubrotamers",&FRMRotamer::subrotamer_size)
     .def("GetSubrotamerDefinition",&WrapGetSubrotamerDefinition,(arg("index")))
     .def("GetSubrotamerAssociations",&WrapGetSubrotamerAssociations,(arg("index")))
-    .def("ApplyOnResidue", &FRMRotamer::ApplyOnResidue,(arg("res"),arg("consider_hydrogens")=false,arg("new_res_name")=""))
+    .def("ApplyOnResidue", &FRMRotamer::ApplyOnResidue,
+         (arg("res"),arg("consider_hydrogens")=false,arg("new_res_name")=""))
     .def("GetTransformedCopy",&FRMRotamer::GetTransformedCopy,(arg("transform")))
     .def("CalculateInternalEnergy", &FRMRotamer::CalculateInternalEnergy,(arg("normalization_factor")))
     .def("GetInternalEnergy",&FRMRotamer::GetInternalEnergy)
@@ -258,10 +266,12 @@ void export_Rotamer()
     .def("GetSelfEnergy",&FRMRotamer::GetSelfEnergy)
     .def("GetTemperature",&FRMRotamer::GetTemperature)
     .def("GetProbability",&FRMRotamer::GetProbability)
-    .def("SetInternalEnergy",&FRMRotamer::SetInternalEnergy,(arg("internal_energy")))
+    .def("SetInternalEnergy",&FRMRotamer::SetInternalEnergy,
+         (arg("internal_energy")))
     .def("SetInternalEnergyPrefactor",&FRMRotamer::SetInternalEnergyPrefactor,(arg("prefactor")))
     .def("SetFrameEnergy",&SetFRMFrameEnergyOne,(arg("frame_energy")))
-    .def("SetFrameEnergy",&SetFRMFrameEnergyTwo,(arg("frame_energy"),arg("subrotamer_index")))
+    .def("SetFrameEnergy",&SetFRMFrameEnergyTwo,
+         (arg("frame_energy"),arg("subrotamer_index")))
     .def("SetTemperature",&FRMRotamer::SetTemperature,(arg("temperature")))
     .def("SetProbability",&FRMRotamer::SetProbability,(arg("probability")))
   ; 
@@ -273,7 +283,9 @@ void export_Rotamer()
     .def("__init__",boost::python::make_constructor(&WrapRRMRotamerGroupInit))
     .def("__len__",&RRMRotamerGroup::size)
     .def("__getitem__", &RRMRotamerGroup::operator[], (arg( "index" )))
-    .def("ApplyOnResidue", &RRMRotamerGroup::ApplyOnResidue,(arg("index"),arg("res"),arg("consider_hydrogens")=false,arg("new_res_name")=""))
+    .def("ApplyOnResidue", &RRMRotamerGroup::ApplyOnResidue,
+         (arg("index"), arg("res"), arg("consider_hydrogens")=false,
+          arg("new_res_name")=""))
     .def("Merge",&RRMRotamerGroup::Merge,(arg("other")))
     .def("CalculateInternalEnergies", &RRMRotamerGroup::CalculateInternalEnergies)
     .def("ApplySelfEnergyThresh",&RRMRotamerGroup::ApplySelfEnergyThresh,(arg("thresh")=30))
@@ -286,104 +298,103 @@ void export_Rotamer()
     .def("__init__",boost::python::make_constructor(&WrapFRMRotamerGroupInit))
     .def("__len__",&FRMRotamerGroup::size)
     .def("__getitem__", &FRMRotamerGroup::operator[], (arg( "index" )))
-    .def("ApplyOnResidue", &FRMRotamerGroup::ApplyOnResidue,(arg("index"),arg("res"),arg("consider_hydrogens")=false,arg("new_res_name")=""))
+    .def("ApplyOnResidue", &FRMRotamerGroup::ApplyOnResidue,
+         (arg("index"), arg("res"), arg("consider_hydrogens")=false,
+          arg("new_res_name")=""))
     .def("Merge",&FRMRotamerGroup::Merge,(arg("other")))
     .def("CalculateInternalEnergies", &FRMRotamerGroup::CalculateInternalEnergies)
-    .def("ApplySelfEnergyThresh",&FRMRotamerGroup::ApplySelfEnergyThresh,(arg("thresh")=30))
+    .def("ApplySelfEnergyThresh",&FRMRotamerGroup::ApplySelfEnergyThresh,
+         (arg("thresh")=30))
   ;
 
   register_ptr_to_python<FRMRotamerGroupPtr>();
 
 
-
-  def("ConstructRRMRotamer",&ConstructRRMRotamer_one,(arg("n_pos"),arg("ca_pos"),arg("cb_pos"),
-                                                      arg("rotamer_id"),arg("settings"),arg("probability"),
-                                                      arg("chi1")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi2")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi3")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi4")=std::numeric_limits<Real>::quiet_NaN()));
-
-  def("ConstructRRMRotamer",&ConstructRRMRotamer_two,(arg("residue"),
-                                                      arg("rotamer_id"),arg("settings"),arg("probability"),
-                                                      arg("chi1")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi2")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi3")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi4")=std::numeric_limits<Real>::quiet_NaN()));
-
-
-  def("ConstructFRMRotamer",&ConstructFRMRotamer_one,(arg("n_pos"),arg("ca_pos"),arg("cb_pos"),
-                                                      arg("rotamer_id"),arg("settings"),arg("probability"),
-                                                      arg("chi1")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("sig1")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi2")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("sig2")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi3")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("sig3")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi4")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("sig4")=std::numeric_limits<Real>::quiet_NaN()));
-
-  def("ConstructFRMRotamer",&ConstructFRMRotamer_two,(arg("residue"),
-                                                      arg("rotamer_id"),arg("settings"),arg("probability"),
-                                                      arg("chi1")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("sig1")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi2")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("sig2")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi3")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("sig3")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("chi4")=std::numeric_limits<Real>::quiet_NaN(),
-                                                      arg("sig4")=std::numeric_limits<Real>::quiet_NaN()));
-
-  def("ConstructRRMRotamerGroup",&ConstructRRMRotamerGroup_one,(arg("n_pos"),arg("ca_pos"),arg("cb_pos"),
-                                                                arg("id"),arg("residue_index"),arg("rot_lib"),
-                                                                arg("settings"),arg("phi")=-1.0472,arg("psi")=-0.7854));
-
-  def("ConstructRRMRotamerGroup",&ConstructRRMRotamerGroup_two,(arg("residue"),arg("id"),
-                                                                arg("residue_index"),arg("rot_lib"),
-                                                                arg("settings"),arg("phi")=-1.0472,arg("psi")=-0.7854));
-
-  def("ConstructRRMRotamerGroup",&ConstructRRMRotamerGroup_three,(arg("residue"),
-                                                                  arg("residue_index"),arg("rot_lib"),
-                                                                  arg("settings"),arg("phi")=-1.0472,arg("psi")=-0.7854));
-
-
-  def("ConstructFRMRotamerGroup",&ConstructFRMRotamerGroup_one,(arg("n_pos"),arg("ca_pos"),arg("cb_pos"),
-                                                                arg("id"),arg("residue_index"),arg("rot_lib"),
-                                                                arg("settings"),arg("phi")=-1.0472,arg("psi")=-0.7854));
-
-  def("ConstructFRMRotamerGroup",&ConstructFRMRotamerGroup_two,(arg("residue"),arg("id"),
-                                                                arg("residue_index"),arg("rot_lib"),
-                                                                arg("settings"),arg("phi")=-1.0472,arg("psi")=-0.7854));
-
-  def("ConstructFRMRotamerGroup",&ConstructFRMRotamerGroup_three,(arg("residue"),
-                                                                  arg("residue_index"),arg("rot_lib"),
-                                                                  arg("settings"),arg("phi")=-1.0472,arg("psi")=-0.7854));
-
-
-  def("ConstructRRMRotamerGroup",&ConstructRRMRotamerGroupNoBB_one,(arg("n_pos"),arg("ca_pos"),arg("cb_pos"),
-                                                                    arg("id"),arg("residue_index"),arg("rot_lib"),
-                                                                    arg("settings")));
-
-  def("ConstructRRMRotamerGroup",&ConstructRRMRotamerGroupNoBB_two,(arg("residue"),arg("id"),
-                                                                    arg("residue_index"),arg("rot_lib"),
-                                                                    arg("settings")));
-
-  def("ConstructRRMRotamerGroup",&ConstructRRMRotamerGroupNoBB_three,(arg("residue"),
-                                                                      arg("residue_index"),arg("rot_lib"),
-                                                                      arg("settings")));
-
-
-  def("ConstructFRMRotamerGroup",&ConstructFRMRotamerGroupNoBB_one,(arg("n_pos"),arg("ca_pos"),arg("cb_pos"),
-                                                                    arg("id"),arg("residue_index"),arg("rot_lib"),
-                                                                    arg("settings")));
-
-  def("ConstructFRMRotamerGroup",&ConstructFRMRotamerGroupNoBB_two,(arg("residue"),arg("id"),
-                                                                    arg("residue_index"),arg("rot_lib"),
-                                                                    arg("settings")));
-
-  def("ConstructFRMRotamerGroup",&ConstructFRMRotamerGroupNoBB_three,(arg("residue"),
-                                                                      arg("residue_index"),arg("rot_lib"),
-                                                                      arg("settings")));
-
-
-  def("ReconstructProCD",&promod3::sidechain::ReconstructProCD);
+  def("ConstructRRMRotamer", &ConstructRRMRotamer_one,
+      (arg("n_pos"), arg("ca_pos"), arg("cb_pos"), arg("rotamer_id"),
+       arg("settings"), arg("probability"),
+       arg("chi1")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi2")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi3")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi4")=std::numeric_limits<Real>::quiet_NaN()));
+
+  def("ConstructRRMRotamer", &ConstructRRMRotamer_two,
+      (arg("residue"), arg("rotamer_id"), arg("settings"), arg("probability"),
+       arg("chi1")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi2")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi3")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi4")=std::numeric_limits<Real>::quiet_NaN()));
+
+  def("ConstructFRMRotamer", &ConstructFRMRotamer_one,
+      (arg("n_pos"), arg("ca_pos"), arg("cb_pos"), arg("rotamer_id"),
+       arg("settings"), arg("probability"),
+       arg("chi1")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("sig1")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi2")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("sig2")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi3")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("sig3")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi4")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("sig4")=std::numeric_limits<Real>::quiet_NaN()));
+
+  def("ConstructFRMRotamer", &ConstructFRMRotamer_two,
+      (arg("residue"), arg("rotamer_id"), arg("settings"), arg("probability"),
+       arg("chi1")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("sig1")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi2")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("sig2")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi3")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("sig3")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("chi4")=std::numeric_limits<Real>::quiet_NaN(),
+       arg("sig4")=std::numeric_limits<Real>::quiet_NaN()));
+
+  def("ConstructRRMRotamerGroup", &ConstructRRMRotamerGroup_one,
+      (arg("n_pos"), arg("ca_pos"), arg("cb_pos"), arg("id"),
+       arg("residue_index"), arg("rot_lib"), arg("settings"),
+       arg("phi")=-1.0472, arg("psi")=-0.7854));
+
+  def("ConstructRRMRotamerGroup", &ConstructRRMRotamerGroup_two,
+      (arg("residue"), arg("id"), arg("residue_index"), arg("rot_lib"),
+       arg("settings"), arg("phi")=-1.0472, arg("psi")=-0.7854));
+
+  def("ConstructRRMRotamerGroup", &ConstructRRMRotamerGroup_three,
+      (arg("residue"), arg("residue_index"), arg("rot_lib"), arg("settings"),
+       arg("phi")=-1.0472, arg("psi")=-0.7854));
+
+  def("ConstructFRMRotamerGroup", &ConstructFRMRotamerGroup_one,
+      (arg("n_pos"),arg("ca_pos"),arg("cb_pos"), arg("id"),
+       arg("residue_index"), arg("rot_lib"), arg("settings"),
+       arg("phi")=-1.0472, arg("psi")=-0.7854));
+
+  def("ConstructFRMRotamerGroup", &ConstructFRMRotamerGroup_two,
+      (arg("residue"), arg("id"), arg("residue_index"), arg("rot_lib"),
+       arg("settings"), arg("phi")=-1.0472, arg("psi")=-0.7854));
+
+  def("ConstructFRMRotamerGroup", &ConstructFRMRotamerGroup_three,
+      (arg("residue"), arg("residue_index"), arg("rot_lib"), arg("settings"),
+       arg("phi")=-1.0472, arg("psi")=-0.7854));
+
+  def("ConstructRRMRotamerGroup", &ConstructRRMRotamerGroupNoBB_one,
+      (arg("n_pos"), arg("ca_pos"), arg("cb_pos"), arg("id"),
+       arg("residue_index"), arg("rot_lib"), arg("settings")));
+
+  def("ConstructRRMRotamerGroup", &ConstructRRMRotamerGroupNoBB_two,
+      (arg("residue"), arg("id"), arg("residue_index"), arg("rot_lib"),
+       arg("settings")));
+
+  def("ConstructRRMRotamerGroup", &ConstructRRMRotamerGroupNoBB_three,
+      (arg("residue"), arg("residue_index"), arg("rot_lib"), arg("settings")));
+
+  def("ConstructFRMRotamerGroup", &ConstructFRMRotamerGroupNoBB_one,
+      (arg("n_pos"), arg("ca_pos"), arg("cb_pos"), arg("id"),
+       arg("residue_index"), arg("rot_lib"), arg("settings")));
+
+  def("ConstructFRMRotamerGroup", &ConstructFRMRotamerGroupNoBB_two,
+      (arg("residue"), arg("id"), arg("residue_index"), arg("rot_lib"),
+       arg("settings")));
+
+  def("ConstructFRMRotamerGroup", &ConstructFRMRotamerGroupNoBB_three,
+      (arg("residue"), arg("residue_index"), arg("rot_lib"), arg("settings")));
+
+  def("ReconstructProCD", &promod3::sidechain::ReconstructProCD);
 }
diff --git a/sidechain/pymod/export_rotamer_cruncher.cc b/sidechain/pymod/export_rotamer_cruncher.cc
index 1787360afb0b0774f56eee0c2bb1aaa4707c46d4..0a1458d35f48dfe1d0b4f25727f4cb238182b683 100644
--- a/sidechain/pymod/export_rotamer_cruncher.cc
+++ b/sidechain/pymod/export_rotamer_cruncher.cc
@@ -1,30 +1,28 @@
 #include <boost/python.hpp>
 #include <boost/python/register_ptr_to_python.hpp>
 #include <promod3/sidechain/rotamer_cruncher.hh>
-
+#include <promod3/core/export_helper.hh>
 
 using namespace boost::python;
+using namespace promod3;
 using namespace promod3::sidechain;
 
+namespace {
 
-namespace{
+void wrap_Initialize(RotamerCruncherPtr cruncher, const String& seqres, 
+                     const boost::python::list& weights) {
+  std::vector<Real> v_weights;
+  core::ConvertListToVector(weights, v_weights);
+  cruncher->Initialize(seqres, v_weights);
+}
+void wrap_UpdateRotamerProbabilities(RotamerCruncherPtr cruncher,
+                                     boost::python::list rotamers,
+                                     uint seqres_pos, Real sigma) {
+  std::vector<RotamerLibEntryPtr> v_rotamers;
+  core::ConvertListToVector(rotamers, v_rotamers);
+  cruncher->UpdateRotamerProbabilities(v_rotamers, seqres_pos, sigma);
+}
 
-  void wrap_Initialize(RotamerCruncherPtr cruncher, const String& seqres, 
-                       const boost::python::list& weights){
-    std::vector<Real> v_weights;
-    for(int i = 0; i < boost::python::len(weights); ++i){
-      v_weights.push_back(boost::python::extract<Real>(weights[i]));
-    }
-    cruncher->Initialize(seqres,v_weights);
-  }
-  void wrap_UpdateRotamerProbabilities(RotamerCruncherPtr cruncher, boost::python::list rotamers,
-                                       uint seqres_pos, Real sigma){
-    std::vector<RotamerLibEntryPtr> v_rotamers;
-    for(int i = 0; i < boost::python::len(rotamers); ++i){
-      v_rotamers.push_back(boost::python::extract<RotamerLibEntryPtr>(rotamers[i]));
-    }
-    cruncher->UpdateRotamerProbabilities(v_rotamers,seqres_pos,sigma);
-  }
 }
 
 void export_RotamerCruncher()
@@ -35,7 +33,9 @@ void export_RotamerCruncher()
     .def("Load", &RotamerCruncher::Load,(arg("filename"))).staticmethod("Load")
     .def("AddStructure", &RotamerCruncher::AddStructure)
     .def("MergeDensities", &RotamerCruncher::MergeDensities)
-    .def("GetExtractedProbability",&RotamerCruncher::GetExtractedProbability,(arg("seqres_pos"),arg("chi1"),arg("chi2")=std::numeric_limits<Real>::quiet_NaN()))
+    .def("GetExtractedProbability", &RotamerCruncher::GetExtractedProbability,
+         (arg("seqres_pos"), arg("chi1"),
+          arg("chi2")=std::numeric_limits<Real>::quiet_NaN()))
     .def("UpdateRotamerProbabilities", &wrap_UpdateRotamerProbabilities)
   ;  
 
diff --git a/sidechain/pymod/export_rotamer_density.cc b/sidechain/pymod/export_rotamer_density.cc
index 86f692070a003c95598b0f8886e6af2e80147c50..60b9a1eafe6b8178704b4062a7f9dc02f1e10836 100644
--- a/sidechain/pymod/export_rotamer_density.cc
+++ b/sidechain/pymod/export_rotamer_density.cc
@@ -1,61 +1,51 @@
 #include <boost/python.hpp>
 #include <boost/python/register_ptr_to_python.hpp>
-
+#include <promod3/core/export_helper.hh>
 #include <promod3/sidechain/rotamer_density.hh>
 
-
 using namespace boost::python;
+using namespace promod3;
 using namespace promod3::sidechain;
 
-namespace{
-
-  RotamerDensity1DPtr WrapRotamerDensity1DListInit(boost::python::list& densities,
-                                                   boost::python::list& weights){
-    std::vector<RotamerDensity1DPtr> v_densities;
-    std::vector<Real> v_weights;
-    for(uint i = 0; i < boost::python::len(densities); ++i){
-      v_densities.push_back(boost::python::extract<RotamerDensity1DPtr>(densities[i]));
-    }
-    for(uint i = 0; i < boost::python::len(weights); ++i){
-      v_weights.push_back(boost::python::extract<Real>(weights[i]));
-    }
-    return RotamerDensity1DPtr(new RotamerDensity1D(v_densities,v_weights));
-  }
-
-  RotamerDensity1DPtr WrapRotamerDensity1DInit(uint num_bins){
-    return RotamerDensity1DPtr(new RotamerDensity1D(num_bins));
-  }
-
-  RotamerDensity2DPtr WrapRotamerDensity2DListInit(boost::python::list& densities,
-                                                   boost::python::list& weights){
-    std::vector<RotamerDensity2DPtr> v_densities;
-    std::vector<Real> v_weights;
-    for(uint i = 0; i < boost::python::len(densities); ++i){
-      v_densities.push_back(boost::python::extract<RotamerDensity2DPtr>(densities[i]));
-    }
-    for(uint i = 0; i < boost::python::len(weights); ++i){
-      v_weights.push_back(boost::python::extract<Real>(weights[i]));
-    }
-    return RotamerDensity2DPtr(new RotamerDensity2D(v_densities,v_weights));
-  }
-
-  RotamerDensity2DPtr WrapRotamerDensity2DInit(uint num_bins){
-    return RotamerDensity2DPtr(new RotamerDensity2D(num_bins));
-  }
-
-  Real wrap_GetPOne(RotamerDensity1DPtr p, Real chi1){
-    Real chi_angles[] = {chi1};
-    return p->GetP(chi_angles);
-  }
-
-  Real wrap_GetPTwo(RotamerDensity2DPtr p, Real chi1, Real chi2){
-    Real chi_angles[] = {chi1, chi2};
-    return p->GetP(chi_angles);
-  }
+namespace {
+
+RotamerDensity1DPtr WrapRotamerDensity1DListInit(boost::python::list& densities,
+                                                 boost::python::list& weights) {
+  std::vector<RotamerDensity1DPtr> v_densities;
+  std::vector<Real> v_weights;
+  core::ConvertListToVector(densities, v_densities);
+  core::ConvertListToVector(weights, v_weights);
+  return RotamerDensity1DPtr(new RotamerDensity1D(v_densities, v_weights));
+}
+
+RotamerDensity1DPtr WrapRotamerDensity1DInit(uint num_bins){
+  return RotamerDensity1DPtr(new RotamerDensity1D(num_bins));
+}
+
+RotamerDensity2DPtr WrapRotamerDensity2DListInit(boost::python::list& densities,
+                                                 boost::python::list& weights) {
+  std::vector<RotamerDensity2DPtr> v_densities;
+  std::vector<Real> v_weights;
+  core::ConvertListToVector(densities, v_densities);
+  core::ConvertListToVector(weights, v_weights);
+  return RotamerDensity2DPtr(new RotamerDensity2D(v_densities, v_weights));
+}
+
+RotamerDensity2DPtr WrapRotamerDensity2DInit(uint num_bins){
+  return RotamerDensity2DPtr(new RotamerDensity2D(num_bins));
+}
 
+Real wrap_GetPOne(RotamerDensity1DPtr p, Real chi1){
+  Real chi_angles[] = {chi1};
+  return p->GetP(chi_angles);
+}
 
+Real wrap_GetPTwo(RotamerDensity2DPtr p, Real chi1, Real chi2){
+  Real chi_angles[] = {chi1, chi2};
+  return p->GetP(chi_angles);
 }
 
+}
 
 
 void export_RotamerDensity()
diff --git a/sidechain/pymod/export_rotamer_lib.cc b/sidechain/pymod/export_rotamer_lib.cc
index b7fa1b69ba34d48ca002403d919eb300fd4a4e4a..dbe530a62b0114d9642962fb2854fe5f2f2c183f 100644
--- a/sidechain/pymod/export_rotamer_lib.cc
+++ b/sidechain/pymod/export_rotamer_lib.cc
@@ -10,29 +10,29 @@ using namespace promod3;
 using namespace promod3::sidechain;
 using namespace boost::python;
 
-namespace{
+namespace {
 
-boost::python::list query_bbdep_wrapper(promod3::sidechain::BBDepRotamerLibPtr lib, 
-                                        RotamerID id, Real phi, Real psi){
+boost::python::list query_bbdep_wrapper(sidechain::BBDepRotamerLibPtr lib, 
+                                        RotamerID id, Real phi, Real psi) {
 
   boost::python::list return_list;
   std::pair<RotamerLibEntry*,uint> lib_entries = lib->QueryLib(id, phi, psi);
-  for(uint i = 0; i < lib_entries.second; ++i){
+  for (uint i = 0; i < lib_entries.second; ++i) {
     return_list.append(*lib_entries.first);
     ++lib_entries.first;
-  } 
+  }
   return return_list;
 }
 
-boost::python::list query_wrapper(promod3::sidechain::RotamerLibPtr lib, 
-                                  RotamerID id){
+boost::python::list query_wrapper(sidechain::RotamerLibPtr lib,
+                                  RotamerID id) {
 
   boost::python::list return_list;
   std::pair<RotamerLibEntry*,uint> lib_entries = lib->QueryLib(id);
-  for(uint i = 0; i < lib_entries.second; ++i){
+  for (uint i = 0; i < lib_entries.second; ++i) {
     return_list.append(*lib_entries.first);
     ++lib_entries.first;
-  } 
+  }
   return return_list;
 }