diff --git a/loop/src/CMakeLists.txt b/loop/src/CMakeLists.txt
index 5b28876070c4155e722397641332708a89510651..620e1495f58261ebfcdcab4cdbcd3721f5c0abb0 100644
--- a/loop/src/CMakeLists.txt
+++ b/loop/src/CMakeLists.txt
@@ -38,5 +38,5 @@ set(LOOP_SOURCES
 )
 
 module(NAME loop HEADERS ${LOOP_HEADERS} SOURCES ${LOOP_SOURCES}
-       DEPENDS_ON promod3_core promod3_sidechain 
+       DEPENDS_ON promod3_core
        LINK ${OST_LIBRARIES} ${BOOST_LIBRARIES} ${LAPACK_LIBRARIES})
diff --git a/sidechain/pymod/_reconstruct_sidechains.py b/sidechain/pymod/_reconstruct_sidechains.py
index 589b00e758e165c7828c2f62e81c656404f942eb..6b9a900f8bd260cf71e5aa4b4db68e2d289ad2ce 100644
--- a/sidechain/pymod/_reconstruct_sidechains.py
+++ b/sidechain/pymod/_reconstruct_sidechains.py
@@ -75,7 +75,8 @@ def _AddBackboneFrameResidues(frame_residues, res_list, rotamer_ids,
         try:
             frame_residue = sidechain.ConstructBackboneFrameResidue(\
                                 r.handle, rotamer_ids[i], i, rotamer_settings,
-                                phi_angles[i], r.HasProp("n_ter"), r.HasProp("c_ter"))
+                                phi_angles[i], r.HasProp("n_ter"),
+                                r.HasProp("c_ter"))
             frame_residues.append(frame_residue)
         except:
             continue
diff --git a/sidechain/src/CMakeLists.txt b/sidechain/src/CMakeLists.txt
index acafe477a2b2bf8644445c2dcf3dc94c9798f1ed..38cde971e29dae838559e10aad4c5a5c420f146d 100644
--- a/sidechain/src/CMakeLists.txt
+++ b/sidechain/src/CMakeLists.txt
@@ -46,4 +46,4 @@ rotamer_cruncher.cc
 )
 
 module(NAME sidechain HEADERS ${SIDECHAIN_HEADERS} SOURCES ${SIDECHAIN_SOURCES}
-	   DEPENDS_ON promod3_core LINK ${OST_LIBRARIES} ${BOOST_LIBRARIES})
+	     DEPENDS_ON promod3_core LINK ${OST_LIBRARIES} ${BOOST_LIBRARIES})
diff --git a/sidechain/src/frame_constructor.cc b/sidechain/src/frame_constructor.cc
index 415b26dbd4cafa90ef08584bd182284ea74624ad..95f8655b088e127694b747e2c3752473781bd070 100644
--- a/sidechain/src/frame_constructor.cc
+++ b/sidechain/src/frame_constructor.cc
@@ -132,11 +132,11 @@ FrameResiduePtr ConstructSidechainFrameARG(const ost::mol::ResidueHandle& res,
   ost::mol::AtomHandle nh1 = res.FindAtom("NH1");
   ost::mol::AtomHandle nh2 = res.FindAtom("NH2");
 
-  if(!cg.IsValid() || !cd.IsValid() || !ne.IsValid() || 
-     !cz.IsValid() || !nh1.IsValid() || !nh2.IsValid()){
+  if (!cg.IsValid() || !cd.IsValid() || !ne.IsValid() || 
+      !cz.IsValid() || !nh1.IsValid() || !nh2.IsValid()) {
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str());
   }
 
@@ -224,8 +224,8 @@ FrameResiduePtr ConstructSidechainFrameASN(const ost::mol::ResidueHandle& res,
 
   if(!cg.IsValid() || !od1.IsValid() || !nd2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str());
   }
 
@@ -280,8 +280,8 @@ FrameResiduePtr ConstructSidechainFrameASP(const ost::mol::ResidueHandle& res,
 
   if(!cg.IsValid() || !od1.IsValid() || !od2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str());
   }
 
@@ -317,8 +317,8 @@ FrameResiduePtr ConstructSidechainFrameGLN(const ost::mol::ResidueHandle& res,
 
   if(!cg.IsValid() || !cd.IsValid() || !oe1.IsValid() || !ne2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str());
   } 
 
@@ -378,8 +378,8 @@ FrameResiduePtr ConstructSidechainFrameGLU(const ost::mol::ResidueHandle& res,
 
   if(!cg.IsValid() || !cd.IsValid() || !oe1.IsValid() || !oe2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str());
   } 
 
@@ -417,8 +417,8 @@ FrameResiduePtr ConstructSidechainFrameLYS(const ost::mol::ResidueHandle& res,
 
   if(!cg.IsValid() || !cd.IsValid() || !ce.IsValid() || !nz.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str());
   }  
 
@@ -481,8 +481,8 @@ FrameResiduePtr ConstructSidechainFrameSER(const ost::mol::ResidueHandle& res,
 
   if(!og.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -540,8 +540,8 @@ FrameResiduePtr ConstructSidechainFrameCYS(const ost::mol::ResidueHandle& res,
 
   if(!sg.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -563,8 +563,8 @@ FrameResiduePtr ConstructSidechainFrameMET(const ost::mol::ResidueHandle& res,
 
   if(!cg.IsValid() || !sd.IsValid() || !ce.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -601,8 +601,8 @@ FrameResiduePtr ConstructSidechainFrameTRP(const ost::mol::ResidueHandle& res,
      !ne1.IsValid() || !ce3.IsValid() || !cz3.IsValid() || !ch2.IsValid() ||
      !cz2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -671,8 +671,8 @@ FrameResiduePtr ConstructSidechainFrameTYR(const ost::mol::ResidueHandle& res,
   if(!cg.IsValid() || !cd1.IsValid() || !cd2.IsValid() || !ce1.IsValid() ||
      !ce2.IsValid() || !cz.IsValid() || !oh.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -748,8 +748,8 @@ FrameResiduePtr ConstructSidechainFrameTHR(const ost::mol::ResidueHandle& res,
   //it is guaranteed from the calling function, that ca and cb exist...
   if(!og1.IsValid() || !cg2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -807,8 +807,8 @@ FrameResiduePtr ConstructSidechainFrameVAL(const ost::mol::ResidueHandle& res,
 
   if(!cg1.IsValid() || !cg2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -835,8 +835,8 @@ FrameResiduePtr ConstructSidechainFrameILE(const ost::mol::ResidueHandle& res,
 
   if(!cg1.IsValid() || !cg2.IsValid() || !cd1.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -863,8 +863,8 @@ FrameResiduePtr ConstructSidechainFrameLEU(const ost::mol::ResidueHandle& res,
 
   if(!cg.IsValid() || !cd1.IsValid() || !cd2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -890,8 +890,8 @@ FrameResiduePtr ConstructSidechainFramePRO(const ost::mol::ResidueHandle& res,
 
   if(!cg.IsValid() || !cd.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -920,8 +920,8 @@ FrameResiduePtr ConstructSidechainFrameHIS(const ost::mol::ResidueHandle& res,
   if(!cg.IsValid() || !nd1.IsValid() || !cd2.IsValid() || 
      !ce1.IsValid() || !ne2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -991,8 +991,8 @@ FrameResiduePtr ConstructSidechainFrameHSD(const ost::mol::ResidueHandle& res,
   if(!cg.IsValid() || !nd1.IsValid() || !cd2.IsValid() || 
      !ce1.IsValid() || !ne2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -1048,8 +1048,8 @@ FrameResiduePtr ConstructSidechainFrameHSE(const ost::mol::ResidueHandle& res,
   if(!cg.IsValid() || !nd1.IsValid() || !cd2.IsValid() || 
      !ce1.IsValid() || !ne2.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
@@ -1107,8 +1107,8 @@ FrameResiduePtr ConstructSidechainFramePHE(const ost::mol::ResidueHandle& res,
   if(!cg.IsValid() || !cd1.IsValid() || !cd2.IsValid() || 
      !ce1.IsValid() || !ce2.IsValid() || !cz.IsValid()){
     std::stringstream ss;
-    ss << "Cannot use sidechain of " << res.GetQualifiedName() << " as frameresidue,";
-    ss << " not all atoms are present."; 
+    ss << "Cannot use sidechain of " << res.GetQualifiedName()
+       << " as frameresidue, not all atoms are present.";
     throw promod3::Error(ss.str()); 
   }
 
diff --git a/sidechain/src/frame_constructor.hh b/sidechain/src/frame_constructor.hh
index 76b3b7a1c678c1b637cca30f8ff71297f5e48099..85dc3b428dc3da77c6a1feacef81dd016a0e00d8 100644
--- a/sidechain/src/frame_constructor.hh
+++ b/sidechain/src/frame_constructor.hh
@@ -23,18 +23,22 @@ FrameResiduePtr ConstructBackboneFrameResidue(
         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=false, bool c_ter=false);
+        RotamerSettingsPtr settings, Real phi, bool n_ter = false,
+        bool c_ter = false);
 
-FrameResiduePtr ConstructBackboneFrameResidue(const ost::mol::ResidueHandle& res, RotamerID id,
-                                              uint residue_index, RotamerSettingsPtr settings,
-                                              Real phi, bool n_ter = false, bool c_ter = false);
+FrameResiduePtr ConstructBackboneFrameResidue(
+        const ost::mol::ResidueHandle& res, RotamerID id, uint residue_index,
+        RotamerSettingsPtr settings, Real phi, bool n_ter = false,
+        bool c_ter = false);
 
 
-FrameResiduePtr ConstructSidechainFrameResidue(const ost::mol::ResidueHandle& res, RotamerID id,
-                                               uint residue_index, RotamerSettingsPtr settings);
+FrameResiduePtr ConstructSidechainFrameResidue(
+        const ost::mol::ResidueHandle& res, RotamerID id, uint residue_index,
+        RotamerSettingsPtr settings);
 
 
-FrameResiduePtr ConstructFrameResidue(const ost::mol::ResidueHandle& res, uint residue_index);
+FrameResiduePtr ConstructFrameResidue(const ost::mol::ResidueHandle& res,
+                                      uint residue_index);
 
 FrameResiduePtr ConstructFrameResidue(RRMRotamerPtr rot, uint index);
 
diff --git a/sidechain/src/rotamer_id.cc b/sidechain/src/rotamer_id.cc
index 8c9807f7e7ae2b2ced62d11321722a598a2450d9..efd547d98d4e0b79edf2762add660b38d214fa33 100644
--- a/sidechain/src/rotamer_id.cc
+++ b/sidechain/src/rotamer_id.cc
@@ -1,166 +1,112 @@
 #include <promod3/sidechain/rotamer_id.hh>
 #include <promod3/core/runtime_profiling.hh>
 
-namespace promod3{ namespace sidechain{
+namespace promod3 { namespace sidechain {
 
-RotamerID TLCToRotID(const String& tlc){
+RotamerID TLCToRotID(const String& tlc) {
 
   core::ScopedTimerPtr prof = core::StaticRuntimeProfiler::StartScoped(
                                 "sidechain::TLCToRotID", 2);
 
-  switch(tlc[0]){
-
-    case 'A':{
-      if(tlc == "ARG"){
-        return ARG;
-      }
-      if(tlc == "ASN"){
-        return ASN;
-      }
-      if(tlc == "ASP"){
-        return ASP;
-      }
-      if(tlc == "ALA"){
-        return ALA;
-      }
+  switch (tlc[0]) {
+
+    case 'A': {
+      if (tlc == "ARG") return ARG;
+      if (tlc == "ASN") return ASN;
+      if (tlc == "ASP") return ASP;
+      if (tlc == "ALA") return ALA;
       break;
     }
 
-    case 'C':{
-      if(tlc == "CYS"){
-        return CYS;
-      }
-      if(tlc == "CYH"){
-        return CYH;
-      }
-      if(tlc == "CYD"){
-        return CYD;
-      }
-      if(tlc == "CPR"){
-        return CPR;
-      }
+    case 'C': {
+      if (tlc == "CYS") return CYS;
+      if (tlc == "CYH") return CYH;
+      if (tlc == "CYD") return CYD;
+      if (tlc == "CPR") return CPR;
       break;
     }
 
-    case 'G':{
-      if(tlc == "GLU"){
-        return GLU;
-      }
-      if(tlc == "GLN"){
-        return GLN;
-      }
-      if(tlc == "GLY"){
-        return GLY;
-      }
+    case 'G': {
+      if (tlc == "GLU") return GLU;
+      if (tlc == "GLN") return GLN;
+      if (tlc == "GLY") return GLY;
       break;
     }
 
-    case 'H':{
-      if(tlc == "HIS"){
-        return HIS;
-      }
-      if(tlc == "HSE"){
-        return HSE;
-      }
-      if(tlc == "HSD"){
-        return HSD;
-      }
+    case 'H': {
+      if (tlc == "HIS") return HIS;
+      if (tlc == "HSE") return HSE;
+      if (tlc == "HSD") return HSD;
       break;
     }
 
-    case 'I':{
-      if(tlc == "ILE"){
-        return ILE;
-      }
+    case 'I': {
+      if (tlc == "ILE") return ILE;
       break;
     }
 
-    case 'L':{
-      if(tlc == "LEU"){
-        return LEU;
-      }
-      if(tlc == "LYS"){
-        return LYS;        
-      }
+    case 'L': {
+      if (tlc == "LEU") return LEU;
+      if (tlc == "LYS") return LYS;
       break;
     }
 
-    case 'M':{
-      if(tlc == "MET"){
-        return MET;
-      }
-      if(tlc == "MSE"){
-        return MET;
-      }
+    case 'M': {
+      if (tlc == "MET") return MET;
+      if (tlc == "MSE") return MET;
       break;
     }
 
-    case 'P':{
-      if(tlc == "PRO"){
-        return PRO;
-      }
-      if(tlc == "PHE"){
-        return PHE;
-      }
+    case 'P': {
+      if (tlc == "PRO") return PRO;
+      if (tlc == "PHE") return PHE;
       break;
     }
 
-    case 'S':{
-      if(tlc == "SER"){
-        return SER;
-      }
+    case 'S': {
+      if (tlc == "SER") return SER;
       break;
     }
 
-    case 'T':{
-      if(tlc == "THR"){
-        return THR;
-      }
-      if(tlc == "TYR"){
-        return TYR;
-      }
-      if(tlc == "TRP"){
-        return TRP;
-      }
-      if(tlc == "TPR"){
-        return TPR;
-      }
+    case 'T': {
+      if (tlc == "THR") return THR;
+      if (tlc == "TYR") return TYR;
+      if (tlc == "TRP") return TRP;
+      if (tlc == "TPR") return TPR;
       break;
     }
 
-    case 'V':{
-      if(tlc == "VAL"){
-        return VAL;
-      }
+    case 'V': {
+      if (tlc == "VAL") return VAL;
       break;
     }
   }  
   return XXX;
 }
 
-RotamerID AAToRotID(ost::conop::AminoAcid aa){
-  switch(aa){
-    case ost::conop::ALA: return ALA; 
-    case ost::conop::ARG: return ARG; 
-    case ost::conop::ASN: return ASN; 
-    case ost::conop::ASP: return ASP;  
-    case ost::conop::GLN: return GLN;  
-    case ost::conop::GLU: return GLU; 
-    case ost::conop::LYS: return LYS;  
-    case ost::conop::SER: return SER;  
-    case ost::conop::CYS: return CYS; 
-    case ost::conop::MET: return MET;  
-    case ost::conop::TRP: return TRP;  
-    case ost::conop::TYR: return TYR; 
-    case ost::conop::THR: return THR;  
-    case ost::conop::VAL: return VAL;  
-    case ost::conop::ILE: return ILE; 
-    case ost::conop::LEU: return LEU;  
-    case ost::conop::GLY: return GLY;  
-    case ost::conop::PRO: return PRO; 
-    case ost::conop::HIS: return HIS;  
-    case ost::conop::PHE: return PHE;  
-    default: return XXX;    
+RotamerID AAToRotID(ost::conop::AminoAcid aa) {
+  switch (aa) {
+    case ost::conop::ALA: return ALA;
+    case ost::conop::ARG: return ARG;
+    case ost::conop::ASN: return ASN;
+    case ost::conop::ASP: return ASP;
+    case ost::conop::GLN: return GLN;
+    case ost::conop::GLU: return GLU;
+    case ost::conop::LYS: return LYS;
+    case ost::conop::SER: return SER;
+    case ost::conop::CYS: return CYS;
+    case ost::conop::MET: return MET;
+    case ost::conop::TRP: return TRP;
+    case ost::conop::TYR: return TYR;
+    case ost::conop::THR: return THR;
+    case ost::conop::VAL: return VAL;
+    case ost::conop::ILE: return ILE;
+    case ost::conop::LEU: return LEU;
+    case ost::conop::GLY: return GLY;
+    case ost::conop::PRO: return PRO;
+    case ost::conop::HIS: return HIS;
+    case ost::conop::PHE: return PHE;
+    default: return XXX;
   }
 }