diff --git a/modules/base/pymod/table.py b/modules/base/pymod/table.py
index 6146858baa5abc0236ea248db849fa8b6d7bcb5e..c156af92fd1d0b71eae164a9e627f13d6faaebc1 100644
--- a/modules/base/pymod/table.py
+++ b/modules/base/pymod/table.py
@@ -1712,7 +1712,7 @@ class Table(object):
     
 
 
-  def GaussianSmooth(self, col, std=1.0, na_value=0.0):
+  def GaussianSmooth(self, col, std=1.0, na_value=0.0, padding='reflect', cval=0.0):
 
     '''
     In place gaussian smooth of a column in the table with a given standard deviation.
@@ -1727,13 +1727,22 @@ class Table(object):
     :param na_value: all na (None) values of the speciefied column are set to na_value before smoothing
     :type na_value: `scalar`
 
+    :param padding: allows to handle padding behaviour see scipy ndimage.gaussian_filter1d documentation for more information. standard is reflect
+    :type padding: :class:`str`
+
+    :param cval: constant value used for padding if padding mode is constant
+    :type cval: `scalar`
+
+
+
     :warning: The function depends on *scipy*
     ''' 
 
     try:
       from scipy import ndimage
+      import numpy as np
     except ImportError:
-      LogError("Function needs scipy.ndimage, but I could no import it")
+      LogError("I need scipy.ndimage and numpy, but could not import it")
       raise
       
     idx = self.GetColIndex(col)
@@ -1748,7 +1757,8 @@ class Table(object):
       else:
         vals.append(na_value)
 
-    smoothed_values_ndarray=ndimage.gaussian_filter1d(vals,std)
+    
+    smoothed_values_ndarray=ndimage.gaussian_filter1d(vals,std, mode=padding, cval=cval)
 
     result=[]
 
diff --git a/modules/mol/base/pymod/export_editors.cc b/modules/mol/base/pymod/export_editors.cc
index 241fd007e47ec1da465feeb4ec869a4dc5127c18..c9d7873982ee0b33a51403090dfb8b758fe9922f 100644
--- a/modules/mol/base/pymod/export_editors.cc
+++ b/modules/mol/base/pymod/export_editors.cc
@@ -54,18 +54,6 @@ ResidueHandle (EditorBase::*append_b)(ChainHandle ch, const ResidueKey&,
 ResidueHandle (EditorBase::*append_c)(ChainHandle ch, ResidueHandle residue,
                                       bool deep)=&EditorBase::AppendResidue;
 
-ResidueHandle (EditorBase::*insert_residue_before_a)(ChainHandle chain, int index,
-                                                     const ResNum& num,
-                                                     const ResidueKey& k)=&EditorBase::InsertResidueBefore;
-ResidueHandle (EditorBase::*insert_residue_before_b)(ChainHandle chain, ResidueHandle residue,
-                                                     int index,bool deep)=&EditorBase::InsertResidueBefore;
-
-ResidueHandle (EditorBase::*insert_residue_after_a)(ChainHandle chain, int index,
-                                                    const ResNum& num,
-                                                    const ResidueKey& k)=&EditorBase::InsertResidueAfter;
-ResidueHandle (EditorBase::*insert_residue_after_b)(ChainHandle chain, ResidueHandle residue,
-                                                    int index, bool deep)=&EditorBase::InsertResidueAfter;
-
 AtomHandle (EditorBase::*insert_atom_a)(ResidueHandle residue, const String& name,
                                         const geom::Vec3& pos, const String& ele,
                                         Real occupancy, Real b_factor,
@@ -240,12 +228,8 @@ void export_Editors()
     .def("DeleteResidue", &EditorBase::DeleteResidue)
     .def("DeleteChain", &EditorBase::DeleteChain)
     .def("DeleteAtom", &EditorBase::DeleteAtom)
-    .def("InsertResidueBefore", insert_residue_before_a)
-    .def("InsertResidueBefore", insert_residue_before_b, (arg("chain"), arg("residue"),
-                                                          arg("index"), arg("deep")=false))
-    .def("InsertResidueAfter", insert_residue_after_a)
-    .def("InsertResidueAfter", insert_residue_after_b, (arg("chain"), arg("residue"),
-                                                        arg("index"), arg("deep")=false))
+    .def("InsertResidueBefore", &EditorBase::InsertResidueBefore)
+    .def("InsertResidueAfter", &EditorBase::InsertResidueAfter)
     .def("AppendResidue", append_a)
     .def("AppendResidue", append_b)
     .def("AppendResidue", append_c, (arg("chain"), arg("residue"),
diff --git a/modules/mol/base/src/editor_base.cc b/modules/mol/base/src/editor_base.cc
index 49c1311b2f4ccdfb5ea5c4a650836c1a17f57cc6..ebf30627eaf9bf892b2838644789995a80b54c38 100644
--- a/modules/mol/base/src/editor_base.cc
+++ b/modules/mol/base/src/editor_base.cc
@@ -42,47 +42,9 @@ ChainHandle EditorBase::InsertChain(const String& chain_name)
 
 ChainHandle EditorBase::InsertChain(const String& chain_name, ChainHandle chain, bool deep)
 {
-
-  impl::ChainImplPtr inserted_chain=ent_.Impl()->InsertChain(chain.Impl());
+  impl::ChainImplPtr inserted_chain=ent_.Impl()->InsertChain(chain.Impl(), deep);
   inserted_chain->SetName(chain_name);
-
-  if(deep){
-    ResidueHandleIter it=chain.ResiduesBegin(),
-                      it_end=chain.ResiduesEnd();
-    for(;it!=it_end;++it){
-      ResidueHandle res=*it;
-      this->AppendResidue(inserted_chain, res, true);
-    }
-  }
-
   return inserted_chain;
-
-
-
-  /*
-  impl::ChainImplPtr new_chain=chain.Impl();
-  new_chain->SetName(chain_name);
-  if(!deep) new_chain->DeleteAllResidues();
-  return ent_.Impl()->InsertChain(new_chain);
-  */
-  /*
-  if(deep){
-
-    ChainHandle inserted_chain=ent_.Impl()->InsertChain(chain_name);
-
-    ResidueHandleIter it=chain.ResiduesBegin(),
-                      it_end=chain.ResiduesEnd();
-    for(;it!=it_end;++it){
-      ResidueHandle res=*it;
-      this->AppendResidue(inserted_chain, res, true);
-    }
-    return inserted_chain;
-  }
-
-  else{
-    return ent_.Impl()->InsertChain(chain.GetName());
-  }
-  */
 }
 
 ResidueHandle EditorBase::AppendResidue(ChainHandle chain, const ResidueKey& k)
@@ -103,17 +65,7 @@ ResidueHandle EditorBase::AppendResidue(ChainHandle chain, ResidueHandle residue
 {
   CheckHandleValidity(chain);
 
-  impl::ResidueImplPtr inserted_residue=chain.Impl()->AppendResidue(residue.Impl());
-  if(deep)
-  {
-    AtomHandleIter it=residue.AtomsBegin(),
-                   it_end=residue.AtomsEnd();
-    for(;it!=it_end;++it)
-    {
-      AtomHandle atom=*it;
-      this->InsertAtom(inserted_residue,atom);
-    }
-  }
+  impl::ResidueImplPtr inserted_residue=chain.Impl()->AppendResidue(residue.Impl(),deep);
   return inserted_residue;
 }
 
@@ -125,34 +77,6 @@ ResidueHandle EditorBase::InsertResidueBefore(ChainHandle chain, int index,
   return ResidueHandle(chain.Impl()->InsertResidueBefore(index, num, k));
 }
 
-ResidueHandle EditorBase::InsertResidueBefore(ChainHandle chain,
-                                              ResidueHandle residue,
-                                              int index, bool deep)
-{
-  CheckHandleValidity(chain);
-
-  if(deep)
-  {
-    ResidueHandle inserted_residue=chain.Impl()->InsertResidueBefore(index,
-                                                                     residue.GetNumber(),
-                                                                     residue.GetKey());
-    AtomHandleIter it=inserted_residue.AtomsBegin(),
-                   it_end=inserted_residue.AtomsEnd();
-    for(;it!=it_end;++it)
-    {
-      AtomHandle atom=*it;
-      this->InsertAtom(inserted_residue, atom);
-    }
-    return inserted_residue;
-  }
-  else
-  {
-    return ResidueHandle(chain.Impl()->InsertResidueBefore(index,
-                                                           residue.GetNumber(),
-                                                           residue.GetKey()));
-  }
-}
-
 ResidueHandle EditorBase::InsertResidueAfter(ChainHandle chain, int index,
                                              const ResNum& num,
                                              const ResidueKey& k)
@@ -161,30 +85,6 @@ ResidueHandle EditorBase::InsertResidueAfter(ChainHandle chain, int index,
   return ResidueHandle(chain.Impl()->InsertResidueAfter(index, num, k));  
 }
 
-ResidueHandle EditorBase::InsertResidueAfter(ChainHandle chain, ResidueHandle residue,
-                                             int index, bool deep)
-{
-  if(deep)
-  {
-    ResidueHandle inserted_residue=chain.Impl()->InsertResidueAfter(index,
-                                                                    residue.GetNumber(),
-                                                                    residue.GetKey());
-    AtomHandleIter it=inserted_residue.AtomsBegin(),
-                   it_end=inserted_residue.AtomsEnd();
-    for(;it!=it_end;++it)
-    {
-      this->InsertAtom(inserted_residue, *it);
-    }
-    return inserted_residue;
-  }
-  else
-  {
-    return ResidueHandle(chain.Impl()->InsertResidueAfter(index,
-                                                          residue.GetNumber(),
-                                                          residue.GetKey()));
-  }
-}
-
 void EditorBase::RenameResidue(ResidueHandle res, const String& new_name)
 {
   CheckHandleValidity(res);
diff --git a/modules/mol/base/src/editor_base.hh b/modules/mol/base/src/editor_base.hh
index 7e969b9101a604d8e45b2270c5843a0317d38518..524849941a691f5b54060ced818e4c45821241aa 100644
--- a/modules/mol/base/src/editor_base.hh
+++ b/modules/mol/base/src/editor_base.hh
@@ -101,8 +101,6 @@ public:
                                     const ResNum& num,
                                     const ResidueKey& k);
 
-  ResidueHandle InsertResidueBefore(ChainHandle chain, ResidueHandle residue,
-                                    int index, bool deep=false);
   /// \brief insert residue into chain
   /// 
   /// This method is identical to InsertResidueBefore() but inserts the
@@ -111,9 +109,6 @@ public:
   ResidueHandle InsertResidueAfter(ChainHandle chain, int index,
                                    const ResNum& num,
                                    const ResidueKey& k);
-
-  ResidueHandle InsertResidueAfter(ChainHandle chain, ResidueHandle residue,
-                                   int index, bool deep=false);
   
   /// \name Adding/removing atoms
   //@{
diff --git a/modules/mol/base/src/impl/chain_impl.cc b/modules/mol/base/src/impl/chain_impl.cc
index 009f436a5406a42caeda27605574587d48decbe3..91261db8e74cd0b9bbd5358c0dfb7892f5a68aa3 100644
--- a/modules/mol/base/src/impl/chain_impl.cc
+++ b/modules/mol/base/src/impl/chain_impl.cc
@@ -61,7 +61,7 @@ bool ChainImpl::InSequence() const {
   return in_sequence_;
 }
 
-ResidueImplPtr ChainImpl::AppendResidue(const ResidueImplPtr& res)
+ResidueImplPtr ChainImpl::AppendResidue(const ResidueImplPtr& res, bool deep)
 {
   ResidueImplPtr dst_res=this->AppendResidue(res->GetKey(), res->GetNumber());
   dst_res->Assign(*res.get());                                                
@@ -70,6 +70,16 @@ ResidueImplPtr ChainImpl::AppendResidue(const ResidueImplPtr& res)
   dst_res->SetChemClass(res->GetChemClass());  
   dst_res->SetProtein(res->IsProtein());
   dst_res->SetIsLigand(res->IsLigand());
+  if(deep)
+  {
+    AtomImplList::iterator it=res->GetAtomList().begin(),
+                             it_end=res->GetAtomList().end();
+      for(;it!=it_end;++it)
+      {
+        AtomHandle atom=*it;
+        dst_res->InsertAtom(atom.Impl());
+      }
+  }
   return dst_res;
 }
 
diff --git a/modules/mol/base/src/impl/chain_impl.hh b/modules/mol/base/src/impl/chain_impl.hh
index 5c11bde4b14c9ba2244c3b40537757ef0b9ba1a1..446c74052937d6947f6a6a4a4b04f0a733730cf7 100644
--- a/modules/mol/base/src/impl/chain_impl.hh
+++ b/modules/mol/base/src/impl/chain_impl.hh
@@ -105,7 +105,7 @@ public:
 
   /// \brief append new residue with exactly the same parameters as res, but 
   ///     no atoms and bonds                               
-  ResidueImplPtr AppendResidue(const ResidueImplPtr& res);
+  ResidueImplPtr AppendResidue(const ResidueImplPtr& res, bool deep=true);
   
   ResidueImplPtr InsertResidueBefore(int index, const ResNum& n, 
                                      const ResidueKey& k);
diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc
index 6942ce00fee8b3a93f45e31c083b90c51c80bdd3..6bdbd835c01b12f48930f2c89ce448a618a0328b 100644
--- a/modules/mol/base/src/impl/entity_impl.cc
+++ b/modules/mol/base/src/impl/entity_impl.cc
@@ -125,10 +125,19 @@ EntityImplPtr EntityImpl::Copy()
   return ent_p;
 }
 
-ChainImplPtr EntityImpl::InsertChain(const ChainImplPtr& chain)
+ChainImplPtr EntityImpl::InsertChain(const ChainImplPtr& chain, bool deep)
 {
   ChainImplPtr dst_chain=this->InsertChain(chain->GetName());
   dst_chain->Assign(*chain.get());
+  if(deep)
+  {
+      ResidueImplList::iterator it=chain->GetResidueList().begin(),
+                                it_end=chain->GetResidueList().end();
+      for(;it!=it_end;++it){
+        ResidueImplPtr res=*it;
+        dst_chain->AppendResidue(res, true);
+      }
+  }
   return dst_chain;
 }
 
diff --git a/modules/mol/base/src/impl/entity_impl.hh b/modules/mol/base/src/impl/entity_impl.hh
index ccbf85b449cdf035493096c73157a485dc9baea8..209858644faa69c8fd61628cd90d04803f899f8e 100644
--- a/modules/mol/base/src/impl/entity_impl.hh
+++ b/modules/mol/base/src/impl/entity_impl.hh
@@ -109,7 +109,7 @@ public:
   /// \brief insert a new chain based on parameters of the given chain
   /// 
   /// The chain will have no residues and atoms
-  ChainImplPtr InsertChain(const ChainImplPtr& chain);
+  ChainImplPtr InsertChain(const ChainImplPtr& chain, bool deep=false);
   ConnectorImplP Connect(const AtomImplPtr& first, const AtomImplPtr& second,
                          Real len, Real theta, Real phi,
                          unsigned char bond_order);