diff --git a/developer-doc/extract b/developer-doc/extract
index 3f06ceff70b0f1ee877665bf14c57d9ea8a72466..ea4b57b6832f5603dd92c488ae8ae331b3c3d655 100755
--- a/developer-doc/extract
+++ b/developer-doc/extract
@@ -2,14 +2,28 @@
 
 sed s:@SRCDIR@:"$(echo ../src/*)": Doxyfile.in > Doxyfile
 
-cat ../src/*/*cpp | grep PLUMED_REGISTER_ACTION |
+cat ../src/*/*cpp |
+awk '
+  /PLUMED_REGISTER_ACTION/{print}
+  /namespace/{print}
+' |
   sed '
    s/PLUMED_REGISTER_ACTION(/ /
    s/,"/ /
    s/")//
 ' |
-awk '{
-  printf("%s","/// \\class PLMD::"$1"\n");
+awk '
+/namespace/{
+ if($1=="namespace"){
+   namespace=$2;
+   gsub("{","",namespace);
+   namespace=namespace"::";
+ }
+ if(namespace=="PLMD::") namespace="";
+ next;
+ }
+{
+  printf("%s","/// \\class PLMD::"namespace""$1"\n");
   printf("%s","/// \\ingroup INPUTDIRECTIVES\n");
   action=tolower($2);
   firstchar=substr($2,1,1);
diff --git a/src/bias/Bias.cpp b/src/bias/Bias.cpp
index 0e38ed5af6dbff761e38bb8732d8876c5afb183c..6c81c4b16dfc1061e0a7d6cc0148f93c48525cc7 100644
--- a/src/bias/Bias.cpp
+++ b/src/bias/Bias.cpp
@@ -22,6 +22,7 @@
 #include "Bias.h"
 
 using namespace PLMD;
+using namespace PLMD::bias;
 using namespace std;
 
 Bias::Bias(const ActionOptions&ao):
diff --git a/src/bias/Bias.h b/src/bias/Bias.h
index 496205dea3852f0163dc4ba9074f255f4712a74c..7fb42d82314d93fc521a871c5658ca3e28dc8400 100644
--- a/src/bias/Bias.h
+++ b/src/bias/Bias.h
@@ -29,6 +29,7 @@
 #define PLUMED_BIAS_INIT(ao) Action(ao),Bias(ao)
 
 namespace PLMD{
+namespace bias{
 
 /**
 \ingroup INHERIT
@@ -61,6 +62,7 @@ void Bias::resetOutputForces(){
   for(unsigned i=0;i<outputForces.size();++i) outputForces[i]=0.0;
 }
 
+}
 }
 
 #endif
diff --git a/src/bias/BiasExternal.cpp b/src/bias/BiasExternal.cpp
index caf0bbfe2cdeafd637c6cae2db6b870a830ae0c0..83c6b9945e7bcb1b76ffe81b080a1f0dd9972e1d 100644
--- a/src/bias/BiasExternal.cpp
+++ b/src/bias/BiasExternal.cpp
@@ -30,6 +30,7 @@ using namespace std;
 
 
 namespace PLMD{
+namespace bias{
 
 //+PLUMEDOC BIAS EXTERNAL 
 /*
@@ -92,21 +93,21 @@ the order of arguments in the header of the grid file.
 */
 //+ENDPLUMEDOC
 
-class BiasExternal : public Bias{
+class External : public Bias{
 
 private:
   Grid* BiasGrid_;
   
 public:
-  BiasExternal(const ActionOptions&);
-  ~BiasExternal();
+  External(const ActionOptions&);
+  ~External();
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(BiasExternal,"EXTERNAL")
+PLUMED_REGISTER_ACTION(External,"EXTERNAL")
 
-void BiasExternal::registerKeywords(Keywords& keys){
+void External::registerKeywords(Keywords& keys){
   Bias::registerKeywords(keys);
   keys.use("ARG");
   keys.add("compulsory","FILE","the name of the file containing the external potential.");
@@ -114,11 +115,11 @@ void BiasExternal::registerKeywords(Keywords& keys){
   keys.addFlag("SPARSE",false,"specifies that the external potential uses a sparse grid");
 }
 
-BiasExternal::~BiasExternal(){
+External::~External(){
   delete BiasGrid_;
 }
 
-BiasExternal::BiasExternal(const ActionOptions& ao):
+External::External(const ActionOptions& ao):
 PLUMED_BIAS_INIT(ao),
 BiasGrid_(NULL)
 {
@@ -150,7 +151,7 @@ BiasGrid_(NULL)
   } 
 }
 
-void BiasExternal::calculate()
+void External::calculate()
 {
   unsigned ncv=getNumberOfArguments();
   vector<double> cv(ncv), der(ncv);
@@ -169,3 +170,4 @@ void BiasExternal::calculate()
 }
 
 }
+}
diff --git a/src/bias/BiasLWalls.cpp b/src/bias/BiasLWalls.cpp
index 40181f7a821349cf4057764ade5bea2e42924279..2237662ee10cc3b9d2a5fae8a4937592e6fb0a9e 100644
--- a/src/bias/BiasLWalls.cpp
+++ b/src/bias/BiasLWalls.cpp
@@ -28,6 +28,7 @@ using namespace std;
 
 
 namespace PLMD{
+namespace bias{
 
 //+PLUMEDOC BIAS LOWER_WALLS
 /*
@@ -55,21 +56,21 @@ PRINT ARG=uwall.bias,lwall.bias
 */
 //+ENDPLUMEDOC
 
-class BiasLWalls : public Bias{
+class LWalls : public Bias{
   std::vector<double> at;
   std::vector<double> kappa;
   std::vector<double> exp;
   std::vector<double> eps;
   std::vector<double> offset;
 public:
-  BiasLWalls(const ActionOptions&);
+  LWalls(const ActionOptions&);
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(BiasLWalls,"LOWER_WALLS")
+PLUMED_REGISTER_ACTION(LWalls,"LOWER_WALLS")
 
-void BiasLWalls::registerKeywords(Keywords& keys){
+void LWalls::registerKeywords(Keywords& keys){
   Bias::registerKeywords(keys);
   keys.use("ARG");
   keys.add("compulsory","AT","the positions of the wall. The a_i in the expression for a wall.");
@@ -79,7 +80,7 @@ void BiasLWalls::registerKeywords(Keywords& keys){
   keys.add("compulsory","EPS","1.0","the values for s_i in the expression for a wall");
 }
 
-BiasLWalls::BiasLWalls(const ActionOptions&ao):
+LWalls::LWalls(const ActionOptions&ao):
 PLUMED_BIAS_INIT(ao),
 at(getNumberOfArguments(),0),
 kappa(getNumberOfArguments(),0.0),
@@ -119,7 +120,7 @@ offset(getNumberOfArguments(),0.0)
   addComponent("force2"); componentIsNotPeriodic("force2");
 }
 
-void BiasLWalls::calculate(){
+void LWalls::calculate(){
   double ene = 0.0;
   double totf2 = 0.0;
   for(unsigned i=0;i<getNumberOfArguments();++i){
@@ -143,3 +144,4 @@ void BiasLWalls::calculate(){
 }
 
 }
+}
diff --git a/src/bias/BiasMetaD.cpp b/src/bias/BiasMetaD.cpp
index 141a888b639e6097ab3be15537b22c1152612907..69b4b59adb5d2f15619a57d3bf79821ad88a3d28 100644
--- a/src/bias/BiasMetaD.cpp
+++ b/src/bias/BiasMetaD.cpp
@@ -40,6 +40,7 @@ using namespace std;
 
 
 namespace PLMD{
+namespace bias{
 
 //+PLUMEDOC BIAS METAD 
 /*
@@ -103,7 +104,7 @@ PRINT ARG=d1,d2,restraint.bias STRIDE=100  FILE=COLVAR
 */
 //+ENDPLUMEDOC
 
-class BiasMetaD : public Bias{
+class MetaD : public Bias{
 
 private:
   struct Gaussian {
@@ -151,17 +152,17 @@ private:
 
 
 public:
-  BiasMetaD(const ActionOptions&);
-  ~BiasMetaD();
+  MetaD(const ActionOptions&);
+  ~MetaD();
   void calculate();
   void update();
   static void registerKeywords(Keywords& keys);
   bool checkNeedsGradients()const{if(adaptive_==FlexibleBin::geometry){return true;}else{return false;}};
 };
 
-PLUMED_REGISTER_ACTION(BiasMetaD,"METAD")
+PLUMED_REGISTER_ACTION(MetaD,"METAD")
 
-void BiasMetaD::registerKeywords(Keywords& keys){
+void MetaD::registerKeywords(Keywords& keys){
   Bias::registerKeywords(keys);
   keys.use("ARG");
   keys.add("compulsory","SIGMA","the widths of the Gaussian hills");
@@ -185,7 +186,7 @@ void BiasMetaD::registerKeywords(Keywords& keys){
   keys.add("optional","WALKERS_RSTRIDE","stride for reading hills files");
 }
 
-BiasMetaD::~BiasMetaD(){
+MetaD::~MetaD(){
   if(BiasGrid_) delete BiasGrid_;
   hillsOfile_.close();
   delete [] dp_;
@@ -195,7 +196,7 @@ BiasMetaD::~BiasMetaD(){
   }
 }
 
-BiasMetaD::BiasMetaD(const ActionOptions& ao):
+MetaD::MetaD(const ActionOptions& ao):
 PLUMED_BIAS_INIT(ao),
 // Grid stuff initialization
 BiasGrid_(NULL), wgridstride_(0), grid_(false),
@@ -367,7 +368,7 @@ mw_n_(1), mw_dir_("./"), mw_id_(0), mw_rstride_(1)
 
 }
 
-void BiasMetaD::readGaussians(PlumedIFile *ifile)
+void MetaD::readGaussians(PlumedIFile *ifile)
 {
  unsigned ncv=getNumberOfArguments();
  double dummy;
@@ -440,7 +441,7 @@ void BiasMetaD::readGaussians(PlumedIFile *ifile)
  log.printf("  %d Gaussians read\n",nhills);
 }
 
-void BiasMetaD::writeGaussian(const Gaussian& hill, PlumedOFile&file){
+void MetaD::writeGaussian(const Gaussian& hill, PlumedOFile&file){
   unsigned ncv=getNumberOfArguments();
   file.printField("time",getTimeStep()*getStep());
   for(unsigned i=0;i<ncv;++i){
@@ -487,7 +488,7 @@ void BiasMetaD::writeGaussian(const Gaussian& hill, PlumedOFile&file){
   file.printField();
 }
 
-void BiasMetaD::addGaussian(const Gaussian& hill)
+void MetaD::addGaussian(const Gaussian& hill)
 {
  if(!grid_){hills_.push_back(hill);} 
  else{
@@ -525,7 +526,7 @@ void BiasMetaD::addGaussian(const Gaussian& hill)
  }
 }
 
-vector<unsigned> BiasMetaD::getGaussianSupport(const Gaussian& hill)
+vector<unsigned> MetaD::getGaussianSupport(const Gaussian& hill)
 {
  vector<unsigned> nneigh;
  // traditional or flexible hill? 
@@ -566,7 +567,7 @@ vector<unsigned> BiasMetaD::getGaussianSupport(const Gaussian& hill)
  return nneigh;
 }
 
-double BiasMetaD::getBiasAndDerivatives(const vector<double>& cv, double* der)
+double MetaD::getBiasAndDerivatives(const vector<double>& cv, double* der)
 {
  double bias=0.0;
  if(!grid_){
@@ -591,7 +592,7 @@ double BiasMetaD::getBiasAndDerivatives(const vector<double>& cv, double* der)
  return bias;
 }
 
-double BiasMetaD::evaluateGaussian
+double MetaD::evaluateGaussian
  (const vector<double>& cv, const Gaussian& hill, double* der)
 {
  double dp2=0.0;
@@ -650,7 +651,7 @@ double BiasMetaD::evaluateGaussian
  return bias;
 }
 
-double BiasMetaD::getHeight(const vector<double>& cv)
+double MetaD::getHeight(const vector<double>& cv)
 {
  double height=height0_;
  if(welltemp_){
@@ -660,7 +661,7 @@ double BiasMetaD::getHeight(const vector<double>& cv)
  return height;
 }
 
-void BiasMetaD::calculate()
+void MetaD::calculate()
 {
   unsigned ncv=getNumberOfArguments();
   vector<double> cv(ncv);
@@ -680,7 +681,7 @@ void BiasMetaD::calculate()
   delete [] der;
 }
 
-void BiasMetaD::update(){
+void MetaD::update(){
   vector<double> cv(getNumberOfArguments());
   vector<double> thissigma;
   bool multivariate;
@@ -744,7 +745,7 @@ void BiasMetaD::update(){
  } 
 }
 
-void BiasMetaD::finiteDifferenceGaussian
+void MetaD::finiteDifferenceGaussian
  (const vector<double>& cv, const Gaussian& hill)
 {
  log<<"--------- finiteDifferenceGaussian: size "<<cv.size() <<"------------\n";
@@ -774,3 +775,4 @@ void BiasMetaD::finiteDifferenceGaussian
 
 
 }
+}
diff --git a/src/bias/BiasMovingRestraint.cpp b/src/bias/BiasMovingRestraint.cpp
index f6657a02324af43dd7ea1218bbf555347b872eac..ba1e327ddc18620bde74d297bb93de49542187e4 100644
--- a/src/bias/BiasMovingRestraint.cpp
+++ b/src/bias/BiasMovingRestraint.cpp
@@ -28,6 +28,7 @@ using namespace std;
 
 
 namespace PLMD{
+namespace bias{
 
 //+PLUMEDOC BIAS MOVINGRESTRAINT
 /*
@@ -93,7 +94,7 @@ the total bias deposited
 //+ENDPLUMEDOC
 
 
-class BiasMovingRestraint : public Bias{
+class MovingRestraint : public Bias{
   std::vector<std::vector<double> > at;
   std::vector<std::vector<double> > kappa;
   std::vector<int> step;
@@ -102,14 +103,14 @@ class BiasMovingRestraint : public Bias{
   std::vector<string> verse;
   std::vector<double> work;
 public:
-  BiasMovingRestraint(const ActionOptions&);
+  MovingRestraint(const ActionOptions&);
   void calculate();
   static void registerKeywords( Keywords& keys );
 };
 
-PLUMED_REGISTER_ACTION(BiasMovingRestraint,"MOVINGRESTRAINT")
+PLUMED_REGISTER_ACTION(MovingRestraint,"MOVINGRESTRAINT")
 
-void BiasMovingRestraint::registerKeywords( Keywords& keys ){
+void MovingRestraint::registerKeywords( Keywords& keys ){
   Bias::registerKeywords(keys);
   keys.use("ARG");
   keys.add("compulsory","VERSE","B","Tells plumed whether the restraint is only acting for CV larger (U) or smaller (L) than the restraint or whether it is acting on both sides (B)");
@@ -121,7 +122,7 @@ void BiasMovingRestraint::registerKeywords( Keywords& keys ){
   keys.reset_style("KAPPA","compulsory");
 }
 
-BiasMovingRestraint::BiasMovingRestraint(const ActionOptions&ao):
+MovingRestraint::MovingRestraint(const ActionOptions&ao):
 PLUMED_BIAS_INIT(ao),
 verse(getNumberOfArguments())
 {
@@ -171,7 +172,7 @@ verse(getNumberOfArguments())
 }
 
 
-void BiasMovingRestraint::calculate(){
+void MovingRestraint::calculate(){
   double ene=0.0;
   double totf2=0.0;
   unsigned narg=getNumberOfArguments();
@@ -214,5 +215,6 @@ void BiasMovingRestraint::calculate(){
 }
 
 }
+}
 
 
diff --git a/src/bias/BiasRatchet.cpp b/src/bias/BiasRatchet.cpp
index 391b987d9f516521fc4db7e13c56d6bb6aade75a..f4b78352171061d1d70d54587938e1cc9ef6468d 100644
--- a/src/bias/BiasRatchet.cpp
+++ b/src/bias/BiasRatchet.cpp
@@ -28,6 +28,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace bias{
 
 //+PLUMEDOC BIAS ABMD 
 /*
@@ -72,7 +73,7 @@ PRINT ARG=abmd.bias
 */
 //+ENDPLUMEDOC
 
-class BiasRatchet : public Bias{
+class Ratchet : public Bias{
   std::vector<double> to;
   std::vector<double> min;
   std::vector<double> kappa;
@@ -80,14 +81,14 @@ class BiasRatchet : public Bias{
   std::vector<double> seed;
   vector<Random> random;
 public:
-  BiasRatchet(const ActionOptions&);
+  Ratchet(const ActionOptions&);
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(BiasRatchet,"ABMD")
+PLUMED_REGISTER_ACTION(Ratchet,"ABMD")
 
-void BiasRatchet::registerKeywords(Keywords& keys){
+void Ratchet::registerKeywords(Keywords& keys){
   Bias::registerKeywords(keys);
   keys.use("ARG");
   keys.add("compulsory","TO","The array of target values");
@@ -97,7 +98,7 @@ void BiasRatchet::registerKeywords(Keywords& keys){
   keys.add("optional","SEED","Array of seeds for the white noise (add a temperature to the Ratchet)");
 }
 
-BiasRatchet::BiasRatchet(const ActionOptions&ao):
+Ratchet::Ratchet(const ActionOptions&ao):
 PLUMED_BIAS_INIT(ao),
 to(getNumberOfArguments(),0.0),
 min(getNumberOfArguments(),-1.0),
@@ -132,7 +133,7 @@ random(getNumberOfArguments())
 }
 
 
-void BiasRatchet::calculate(){
+void Ratchet::calculate(){
   double ene=0.0;
   double totf2=0.0;
   for(unsigned i=0;i<getNumberOfArguments();++i){
@@ -160,5 +161,6 @@ void BiasRatchet::calculate(){
 }
 
 }
+}
 
 
diff --git a/src/bias/BiasRestraint.cpp b/src/bias/BiasRestraint.cpp
index 212eb2e489b5f9f2aa7bc4165b5ea9f70afdbb9c..4fa9faef89c7460846c2b2536ed9874faafbd1d0 100644
--- a/src/bias/BiasRestraint.cpp
+++ b/src/bias/BiasRestraint.cpp
@@ -28,6 +28,7 @@ using namespace std;
 
 
 namespace PLMD{
+namespace bias{
 
 //+PLUMEDOC BIAS RESTRAINT
 /*
@@ -58,19 +59,19 @@ PRINT ARG=restraint.bias
 */
 //+ENDPLUMEDOC
 
-class BiasRestraint : public Bias{
+class Restraint : public Bias{
   std::vector<double> at;
   std::vector<double> kappa;
   std::vector<double> slope;
 public:
-  BiasRestraint(const ActionOptions&);
+  Restraint(const ActionOptions&);
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(BiasRestraint,"RESTRAINT")
+PLUMED_REGISTER_ACTION(Restraint,"RESTRAINT")
 
-void BiasRestraint::registerKeywords(Keywords& keys){
+void Restraint::registerKeywords(Keywords& keys){
    Bias::registerKeywords(keys);
    keys.use("ARG");
    keys.add("compulsory","SLOPE","0.0","specifies that the restraint is linear and what the values of the force constants on each of the variables are");
@@ -78,7 +79,7 @@ void BiasRestraint::registerKeywords(Keywords& keys){
    keys.add("compulsory","AT","the position of the restraint");
 }
 
-BiasRestraint::BiasRestraint(const ActionOptions&ao):
+Restraint::Restraint(const ActionOptions&ao):
 PLUMED_BIAS_INIT(ao),
 at(getNumberOfArguments()),
 kappa(getNumberOfArguments(),0.0),
@@ -107,7 +108,7 @@ slope(getNumberOfArguments(),0.0)
 }
 
 
-void BiasRestraint::calculate(){
+void Restraint::calculate(){
   double ene=0.0;
   double totf2=0.0;
   for(unsigned i=0;i<getNumberOfArguments();++i){
@@ -126,3 +127,4 @@ void BiasRestraint::calculate(){
 }
 
 
+}
diff --git a/src/bias/BiasUWalls.cpp b/src/bias/BiasUWalls.cpp
index 61939487f41b05887531e5d833271e7bb3fe3681..cffbf00c3cf965fc626b3920bab64fe04cdc3704 100644
--- a/src/bias/BiasUWalls.cpp
+++ b/src/bias/BiasUWalls.cpp
@@ -28,6 +28,7 @@ using namespace std;
 
 
 namespace PLMD{
+namespace bias{
 
 //+PLUMEDOC BIAS UPPER_WALLS
 /*
@@ -55,21 +56,21 @@ PRINT ARG=uwall.bias,lwall.bias
 */
 //+ENDPLUMEDOC
 
-class BiasUWalls : public Bias{
+class UWalls : public Bias{
   std::vector<double> at;
   std::vector<double> kappa;
   std::vector<double> exp;
   std::vector<double> eps;
   std::vector<double> offset;
 public:
-  BiasUWalls(const ActionOptions&);
+  UWalls(const ActionOptions&);
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(BiasUWalls,"UPPER_WALLS")
+PLUMED_REGISTER_ACTION(UWalls,"UPPER_WALLS")
 
-void BiasUWalls::registerKeywords(Keywords& keys){
+void UWalls::registerKeywords(Keywords& keys){
   Bias::registerKeywords(keys);
   keys.use("ARG");
   keys.add("compulsory","AT","the positions of the wall. The a_i in the expression for a wall.");
@@ -79,7 +80,7 @@ void BiasUWalls::registerKeywords(Keywords& keys){
   keys.add("compulsory","EPS","1.0","the values for s_i in the expression for a wall");
 }
 
-BiasUWalls::BiasUWalls(const ActionOptions&ao):
+UWalls::UWalls(const ActionOptions&ao):
 PLUMED_BIAS_INIT(ao),
 at(getNumberOfArguments(),0),
 kappa(getNumberOfArguments(),0.0),
@@ -119,7 +120,7 @@ offset(getNumberOfArguments(),0.0)
   addComponent("force2"); componentIsNotPeriodic("force2");
 }
 
-void BiasUWalls::calculate(){
+void UWalls::calculate(){
   double ene=0.0;
   double totf2=0.0;
   for(unsigned i=0;i<getNumberOfArguments();++i){
@@ -143,3 +144,4 @@ void BiasUWalls::calculate(){
 }
 
 }
+}
diff --git a/src/bias/BiasValue.cpp b/src/bias/BiasValue.cpp
index 27a812dabb0a30a4798aa14a58731de20f2ba6d3..aca62dfab51054d1d15b6ac78b0cff3a025a7975 100644
--- a/src/bias/BiasValue.cpp
+++ b/src/bias/BiasValue.cpp
@@ -28,6 +28,7 @@ using namespace std;
 
 
 namespace PLMD{
+namespace bias{
 
 //+PLUMEDOC BIAS VALUE 
 /*
@@ -49,21 +50,21 @@ PRINT ARG=d1,d2,b.d1,b.d2
 */
 //+ENDPLUMEDOC
 
-class BiasValue : public Bias{
+class Value : public Bias{
 public:
-  BiasValue(const ActionOptions&);
+  Value(const ActionOptions&);
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(BiasValue,"BIASVALUE")
+PLUMED_REGISTER_ACTION(Value,"BIASVALUE")
 
-void BiasValue::registerKeywords(Keywords& keys){
+void Value::registerKeywords(Keywords& keys){
   Bias::registerKeywords(keys);
   keys.use("ARG");
 }
 
-BiasValue::BiasValue(const ActionOptions&ao):
+Value::Value(const ActionOptions&ao):
 PLUMED_BIAS_INIT(ao)
 {
   checkRead();
@@ -77,7 +78,7 @@ PLUMED_BIAS_INIT(ao)
   }
 }
 
-void BiasValue::calculate(){
+void Value::calculate(){
 for(unsigned i=0;i< getNumberOfArguments() ;++i){
   double val; val=getArgument(i); 
 //  log<<"BIAS "<<val<<"\n";
@@ -87,3 +88,4 @@ for(unsigned i=0;i< getNumberOfArguments() ;++i){
 }
 
 }
+}
diff --git a/src/cltools/CLTool.h b/src/cltools/CLTool.h
index b043e98baed8b34595efaddbabc33efaf3fa262a..53e084aff26c04dbd8147ee26d6fc8842497675c 100644
--- a/src/cltools/CLTool.h
+++ b/src/cltools/CLTool.h
@@ -22,4 +22,11 @@
 #ifndef __PLUMED_cltools_CLTool_h
 #define __PLUMED_cltools_CLTool_h
 #include "core/CLTool.h"
+namespace PLMD{
+namespace cltools{
+// Ideally core/Colvar.h should be moved to this directory and Colvar should stay in namespace PLMD::colvar
+// With this trick, PLMD::CLToolMain is visible as PLMD::cltools::CLToolMain
+  using PLMD::CLTool;
+}
+}
 #endif
diff --git a/src/cltools/CLToolDriver.cpp b/src/cltools/CLToolDriver.cpp
index bd48e31eec2dbc01f06c0cf4e3c585e1a6eb6ca2..be7e5d087d0687c022572706287cc36a4e567c76 100644
--- a/src/cltools/CLToolDriver.cpp
+++ b/src/cltools/CLToolDriver.cpp
@@ -34,6 +34,7 @@
 using namespace std;
 
 namespace PLMD {
+namespace cltools{
 
 //+PLUMEDOC TOOLS driver
 /*
@@ -65,16 +66,16 @@ plumed driver --plumed plumed.dat --ixyz trajectory.xyz --trajectory-stride 100
 //+ENDPLUMEDOC
 
 template<typename real>
-class CLToolDriver : public CLTool {
+class Driver : public CLTool {
 public:
   static void registerKeywords( Keywords& keys );
-  CLToolDriver(const CLToolOptions& co );
+  Driver(const CLToolOptions& co );
   int main(FILE* in,FILE*out,PlumedCommunicator& pc);
   string description()const;
 };
 
 template<typename real>
-void CLToolDriver<real>::registerKeywords( Keywords& keys ){
+void Driver<real>::registerKeywords( Keywords& keys ){
   CLTool::registerKeywords( keys );
   keys.addFlag("--help-debug",false,"print special options that can be used to create regtests");
   keys.add("compulsory","--plumed","plumed.dat","specify the name of the plumed input file");
@@ -95,21 +96,21 @@ void CLToolDriver<real>::registerKeywords( Keywords& keys ){
 }
 
 template<typename real>
-CLToolDriver<real>::CLToolDriver(const CLToolOptions& co ):
+Driver<real>::Driver(const CLToolOptions& co ):
 CLTool(co)
 {
  inputdata=commandline;
 }
 
 template<typename real>
-string CLToolDriver<real>::description()const{ return "analyze trajectories with plumed"; }
+string Driver<real>::description()const{ return "analyze trajectories with plumed"; }
 
 template<>
-string CLToolDriver<float>::description()const{ return "analyze trajectories with plumed (single precision version)"; }
+string Driver<float>::description()const{ return "analyze trajectories with plumed (single precision version)"; }
 
 
 template<typename real>
-int CLToolDriver<real>::main(FILE* in,FILE*out,PlumedCommunicator& pc){
+int Driver<real>::main(FILE* in,FILE*out,PlumedCommunicator& pc){
 
   Units units;
   PDB pdb;
@@ -131,8 +132,8 @@ int CLToolDriver<real>::main(FILE* in,FILE*out,PlumedCommunicator& pc){
   std::string fakein; 
   bool debugfloat=parse("--debug-float",fakein);
   if(debugfloat && sizeof(real)!=sizeof(float)){
-      CLTool* cl=cltoolRegister().create(CLToolOptions("driver-float"));    //new CLToolDriver<float>(*this);
-      cl->inputData=this->inputData; 
+      CLTool* cl=cltoolRegister().create(CLToolOptions("driver-float"));    //new Driver<float>(*this);
+      cl->setInputData(this->getInputData());
       int ret=cl->main(in,out,pc);
       delete cl;
       return ret;
@@ -496,12 +497,13 @@ int CLToolDriver<real>::main(FILE* in,FILE*out,PlumedCommunicator& pc){
   return 0;
 }
 
-typedef CLToolDriver<double> CLToolDriverDouble;
-typedef CLToolDriver<float> CLToolDriverFloat;
-PLUMED_REGISTER_CLTOOL(CLToolDriverDouble,"driver")
-PLUMED_REGISTER_CLTOOL(CLToolDriverFloat,"driver-float")
+typedef Driver<double> DriverDouble;
+typedef Driver<float> DriverFloat;
+PLUMED_REGISTER_CLTOOL(DriverDouble,"driver")
+PLUMED_REGISTER_CLTOOL(DriverFloat,"driver-float")
 
 
 
 
+}
 }
diff --git a/src/cltools/CLToolInfo.cpp b/src/cltools/CLToolInfo.cpp
index c03b9985d794f001cc93ac54f937c5de14faf657..470c89019e9911dcd19bec44c7db61317b7d9ca4 100644
--- a/src/cltools/CLToolInfo.cpp
+++ b/src/cltools/CLToolInfo.cpp
@@ -30,6 +30,7 @@
 using namespace std;
 
 namespace PLMD {
+namespace cltools{
 
 //+PLUMEDOC TOOLS info
 /*
@@ -48,33 +49,33 @@ plumed info --root
 */
 //+ENDPLUMEDOC
 
-class CLToolInfo:
+class Info:
 public CLTool
 {
 public:
   static void registerKeywords( Keywords& keys );
-  CLToolInfo(const CLToolOptions& co );
+  Info(const CLToolOptions& co );
   int main(FILE* in, FILE*out,PlumedCommunicator& pc);
   string description()const{
     return "provide informations about plumed";
   }
 };
 
-PLUMED_REGISTER_CLTOOL(CLToolInfo,"info")
+PLUMED_REGISTER_CLTOOL(Info,"info")
 
-void CLToolInfo::registerKeywords( Keywords& keys ){
+void Info::registerKeywords( Keywords& keys ){
   CLTool::registerKeywords( keys );
   keys.addFlag("--configuration",false,"prints the configuration file");
   keys.addFlag("--root",false,"print the location of the root directory for the plumed source");
 }
 
-CLToolInfo::CLToolInfo(const CLToolOptions& co ):
+Info::Info(const CLToolOptions& co ):
 CLTool(co)
 {
   inputdata=commandline;
 }
 
-int CLToolInfo::main(FILE* in, FILE*out,PlumedCommunicator& pc){
+int Info::main(FILE* in, FILE*out,PlumedCommunicator& pc){
 
  bool printconfiguration; parseFlag("--configuration",printconfiguration);
  bool printroot; parseFlag("--root",printroot);
@@ -93,4 +94,5 @@ int CLToolInfo::main(FILE* in, FILE*out,PlumedCommunicator& pc){
 
 
 
+}
 }
diff --git a/src/cltools/CLToolManual.cpp b/src/cltools/CLToolManual.cpp
index 618f98a0d004bf0945215abdf6d7d86399060378..6e788d9e15077465a3a8fa0e046f299ffd906f57 100644
--- a/src/cltools/CLToolManual.cpp
+++ b/src/cltools/CLToolManual.cpp
@@ -32,6 +32,7 @@
 using namespace std;
 
 namespace PLMD {
+namespace cltools{
 
 //+PLUMEDOC TOOLS manual
 /*
@@ -53,32 +54,32 @@ plumed manual --action DISTANCE
 */
 //+ENDPLUMEDOC
 
-class CLToolManual:
+class Manual:
 public CLTool
 {
 public:
   static void registerKeywords( Keywords& keys );
-  CLToolManual(const CLToolOptions& co );
+  Manual(const CLToolOptions& co );
   int main(FILE* in, FILE*out,PlumedCommunicator& pc);
   string description()const{
     return "print out a description of the keywords for an action in html";
   }
 };
 
-PLUMED_REGISTER_CLTOOL(CLToolManual,"manual")
+PLUMED_REGISTER_CLTOOL(Manual,"manual")
 
-void CLToolManual::registerKeywords( Keywords& keys ){
+void Manual::registerKeywords( Keywords& keys ){
   CLTool::registerKeywords( keys );
   keys.add("compulsory","--action","print the manual for this particular action");
 }
 
-CLToolManual::CLToolManual(const CLToolOptions& co ):
+Manual::Manual(const CLToolOptions& co ):
 CLTool(co)
 {
   inputdata=commandline;
 }
 
-int CLToolManual::main(FILE* in, FILE*out,PlumedCommunicator& pc){
+int Manual::main(FILE* in, FILE*out,PlumedCommunicator& pc){
 
  std::string action; 
  if( !parse("--action",action) ) return 1;
@@ -95,3 +96,4 @@ int CLToolManual::main(FILE* in, FILE*out,PlumedCommunicator& pc){
 }
 
 } // End of namespace
+}
diff --git a/src/cltools/CLToolSimpleMD.cpp b/src/cltools/CLToolSimpleMD.cpp
index b8db8b8f309018355607cb759e93c5bc459fb9f6..6788549d4f2adf8f4f2d5f9ab7657aff32b111d1 100644
--- a/src/cltools/CLToolSimpleMD.cpp
+++ b/src/cltools/CLToolSimpleMD.cpp
@@ -33,6 +33,7 @@ using namespace std;
 using namespace PLMD;
 
 namespace PLMD{
+namespace cltools{
 
 //+PLUMEDOC TOOLS simplemd
 /*
@@ -73,7 +74,7 @@ plumed simplemd --help
 */
 //+ENDPLUMEDOC
 
-class CLToolSimpleMD:
+class SimpleMD:
 public PLMD::CLTool
 {
   string description()const{
@@ -107,7 +108,7 @@ static void registerKeywords( Keywords& keys ){
   keys.add("compulsory","ndim","3","The dimensionality of the system (some interesting LJ clusters are two dimensional)");
 }
 
-CLToolSimpleMD( const CLToolOptions& co ) :
+SimpleMD( const CLToolOptions& co ) :
 CLTool(co)
 {
   inputdata=ifile;
@@ -579,9 +580,11 @@ int main(FILE* in,FILE*out,PLMD::PlumedCommunicator& pc){
 
 };
 
+PLUMED_REGISTER_CLTOOL(SimpleMD,"simplemd")
+
+}
 }
 
 
-PLUMED_REGISTER_CLTOOL(CLToolSimpleMD,"simplemd")
 
 
diff --git a/src/cltools/CLToolTemplateGenerator.cpp b/src/cltools/CLToolTemplateGenerator.cpp
index eec043f15d110df202825d505437d84bd3834c4b..88ba246684e83ba65586462dda110d3d29ac22b8 100644
--- a/src/cltools/CLToolTemplateGenerator.cpp
+++ b/src/cltools/CLToolTemplateGenerator.cpp
@@ -32,6 +32,7 @@
 using namespace std;
 
 namespace PLMD {
+namespace cltools{
 
 //+PLUMEDOC TOOLS gentemplate
 /*
@@ -52,34 +53,34 @@ plumed gentemplate --action DISTANCE
 */
 //+ENDPLUMEDOC
 
-class CLToolGenTemplate:
+class GenTemplate:
 public CLTool
 {
 public:
   static void registerKeywords( Keywords& keys );
-  CLToolGenTemplate(const CLToolOptions& co );
+  GenTemplate(const CLToolOptions& co );
   int main(FILE* in, FILE*out,PlumedCommunicator& pc);
   string description()const{
     return "print out a template input for a particular action";
   }
 };
 
-PLUMED_REGISTER_CLTOOL(CLToolGenTemplate,"gentemplate")
+PLUMED_REGISTER_CLTOOL(GenTemplate,"gentemplate")
 
-void CLToolGenTemplate::registerKeywords( Keywords& keys ){
+void GenTemplate::registerKeywords( Keywords& keys ){
   CLTool::registerKeywords( keys );
   keys.add("compulsory","--action","print the template for this particular action");
   keys.addFlag("--list",false,"print a list of the available actions");
   keys.addFlag("--include-optional",false,"also print optional modifiers");
 }
 
-CLToolGenTemplate::CLToolGenTemplate(const CLToolOptions& co ):
+GenTemplate::GenTemplate(const CLToolOptions& co ):
 CLTool(co)
 {
   inputdata=commandline;
 }
 
-int CLToolGenTemplate::main(FILE* in, FILE*out,PlumedCommunicator& pc){
+int GenTemplate::main(FILE* in, FILE*out,PlumedCommunicator& pc){
 
  std::string action; 
  bool list_templates=false;
@@ -101,5 +102,6 @@ int CLToolGenTemplate::main(FILE* in, FILE*out,PlumedCommunicator& pc){
 
  return 0;
 }
+}
 
 } // End of namespace
diff --git a/src/colvar/Colvar.h b/src/colvar/Colvar.h
index 506299b8e1e0dcc42062e482b004b1a8350b1a5c..8df1bf79e387e15885b18aa162c754cf43853dd2 100644
--- a/src/colvar/Colvar.h
+++ b/src/colvar/Colvar.h
@@ -22,4 +22,11 @@
 #ifndef __PLUMED_colvar_Colvar_h
 #define __PLUMED_colvar_Colvar_h
 #include "core/Colvar.h"
+namespace PLMD{
+namespace colvar{
+// Ideally core/Colvar.h should be moved to this directory and Colvar should stay in namespace PLMD::colvar
+// With this trick, PLMD::Colvar is visible as PLMD::colvar::Colvar
+  using PLMD::Colvar;
+}
+}
 #endif
diff --git a/src/colvar/ColvarAngle.cpp b/src/colvar/ColvarAngle.cpp
index 10eee3066383a641fc57b185bf8415ae3f02e6df..304cd54829de5f9ae5e20e2468220ae618d957fa 100644
--- a/src/colvar/ColvarAngle.cpp
+++ b/src/colvar/ColvarAngle.cpp
@@ -30,6 +30,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR ANGLE
 /*
@@ -57,24 +58,24 @@ ANGLE ATOMS=1,2,3,4
 */
 //+ENDPLUMEDOC
    
-class ColvarAngle : public Colvar {
+class Angle : public Colvar {
   bool pbc;
 
 public:
-  ColvarAngle(const ActionOptions&);
+  Angle(const ActionOptions&);
 // active methods:
   virtual void calculate();
   static void registerKeywords( Keywords& keys );
 };
 
-PLUMED_REGISTER_ACTION(ColvarAngle,"ANGLE")
+PLUMED_REGISTER_ACTION(Angle,"ANGLE")
 
-void ColvarAngle::registerKeywords( Keywords& keys ){
+void Angle::registerKeywords( Keywords& keys ){
   Colvar::registerKeywords(keys);
   keys.add("atoms","ATOMS","the list of atoms involved in this collective variable");
 }
 
-ColvarAngle::ColvarAngle(const ActionOptions&ao):
+Angle::Angle(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 pbc(true)
 {
@@ -102,7 +103,7 @@ pbc(true)
 }
 
 // calculator
-void ColvarAngle::calculate(){
+void Angle::calculate(){
 
   Vector dij,dik;
   if(pbc){
@@ -113,7 +114,7 @@ void ColvarAngle::calculate(){
     dik=delta(getPosition(1),getPosition(0));
   }
   Vector ddij,ddik;
-  Angle a;
+  PLMD::Angle a;
   double angle=a.compute(dij,dik,ddij,ddik);
   setAtomsDerivatives(0,ddik);
   setAtomsDerivatives(1,-ddik);
@@ -124,6 +125,7 @@ void ColvarAngle::calculate(){
 }
 
 }
+}
 
 
 
diff --git a/src/colvar/ColvarContactMap.cpp b/src/colvar/ColvarContactMap.cpp
index 2c0e759c40d32ba37c975c70150b65e6f8e0d241..7353cb7e2be07faa04e464ea840c84a221ede12b 100644
--- a/src/colvar/ColvarContactMap.cpp
+++ b/src/colvar/ColvarContactMap.cpp
@@ -31,6 +31,7 @@
 using namespace std;
 
 namespace PLMD {
+namespace colvar {
 
 //+PLUMEDOC COLVAR CONTACTMAP
 /*
@@ -51,7 +52,7 @@ PRINT ARG=f1.* FILE=colvar
 */
 //+ENDPLUMEDOC
 
-class ColvarContactMap : public Colvar {   
+class ContactMap : public Colvar {   
 private:
   bool pbc, dosum;
   NeighborList *nl;
@@ -59,16 +60,16 @@ private:
   bool reduceListAtNextStep;
 public:
   static void registerKeywords( Keywords& keys );
-  ColvarContactMap(const ActionOptions&);
-  ~ColvarContactMap();
+  ContactMap(const ActionOptions&);
+  ~ContactMap();
 // active methods:
   virtual void calculate();
   void checkFieldsAllowed(){};
 };
 
-PLUMED_REGISTER_ACTION(ColvarContactMap,"CONTACTMAP")
+PLUMED_REGISTER_ACTION(ContactMap,"CONTACTMAP")
 
-void ColvarContactMap::registerKeywords( Keywords& keys ){
+void ContactMap::registerKeywords( Keywords& keys ){
   Colvar::registerKeywords( keys );
   keys.add("numbered","ATOMS","the atoms involved in each of the contacts you wish to calculate. "
                    "Keywords like ATOMS1, ATOMS2, ATOMS3,... should be listed and one contact will be "
@@ -82,7 +83,7 @@ void ColvarContactMap::registerKeywords( Keywords& keys ){
   keys.addFlag("SUM",false,"calculate the sum of all the contacts in the input");
 }
 
-ColvarContactMap::ColvarContactMap(const ActionOptions&ao):
+ContactMap::ContactMap(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 pbc(true),
 dosum(false),
@@ -147,11 +148,11 @@ reduceListAtNextStep(false)
   checkRead();
 }
 
-ColvarContactMap::~ColvarContactMap(){
+ContactMap::~ContactMap(){
   delete nl;
 }
 
-void ColvarContactMap::calculate(){ 
+void ContactMap::calculate(){ 
      
  double ncoord=0., coord;
  Tensor virial;
@@ -191,3 +192,4 @@ void ColvarContactMap::calculate(){
 }
 
 }
+}
diff --git a/src/colvar/ColvarCoordination.cpp b/src/colvar/ColvarCoordination.cpp
index 6abe031b363cab676864919fae888f5657efad9d..a3a7a689160eac6fa040256d9c79f51ba916afe3 100644
--- a/src/colvar/ColvarCoordination.cpp
+++ b/src/colvar/ColvarCoordination.cpp
@@ -32,6 +32,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR COORDINATION
 /*
@@ -57,7 +58,7 @@ COORDINATION GROUPA=1-10 GROUPB=20-100 R_0=0.3 NLIST NL_CUTOFF=0.5 NL_STRIDE=100
 */
 //+ENDPLUMEDOC
    
-class ColvarCoordination : public Colvar {
+class Coordination : public Colvar {
   bool pbc;
   bool serial;
   NeighborList *nl;
@@ -66,17 +67,17 @@ class ColvarCoordination : public Colvar {
   bool reduceListAtNextStep;
   
 public:
-  ColvarCoordination(const ActionOptions&);
-  ~ColvarCoordination();
+  Coordination(const ActionOptions&);
+  ~Coordination();
 // active methods:
   virtual void calculate();
   virtual void prepare();
   static void registerKeywords( Keywords& keys );
 };
 
-PLUMED_REGISTER_ACTION(ColvarCoordination,"COORDINATION")
+PLUMED_REGISTER_ACTION(Coordination,"COORDINATION")
 
-void ColvarCoordination::registerKeywords( Keywords& keys ){
+void Coordination::registerKeywords( Keywords& keys ){
   Colvar::registerKeywords(keys);
   keys.addFlag("SERIAL",false,"perform the calcualtion of the coordination number in serial");
   keys.addFlag("PAIR",false,"Evaulate the switching functions for only the 1st element of the 1st group with the first element in the second group etc only");
@@ -94,7 +95,7 @@ void ColvarCoordination::registerKeywords( Keywords& keys ){
   keys.add("optional","NL_STRIDE","The frequency with which we are updating the atoms in the neighbour list");
 }
 
-ColvarCoordination::ColvarCoordination(const ActionOptions&ao):
+Coordination::Coordination(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 pbc(true),
 serial(false),
@@ -170,11 +171,11 @@ reduceListAtNextStep(false)
   }
 }
 
-ColvarCoordination::~ColvarCoordination(){
+Coordination::~Coordination(){
   delete nl;
 }
 
-void ColvarCoordination::prepare(){
+void Coordination::prepare(){
  if(reduceListAtNextStep){
    requestAtoms(nl->getReducedAtomList());
    reduceListAtNextStep=false;
@@ -185,7 +186,7 @@ void ColvarCoordination::prepare(){
 }
 
 // calculator
-void ColvarCoordination::calculate()
+void Coordination::calculate()
 {
 
  double ncoord=0.;
@@ -243,3 +244,4 @@ void ColvarCoordination::calculate()
 
 }
 }
+}
diff --git a/src/colvar/ColvarDRMSD.cpp b/src/colvar/ColvarDRMSD.cpp
index 8b08e17e953d48930ce77ce45f4c881f1c3880ca..9ac5251966b5080a1269ab151f351e5716ba982e 100644
--- a/src/colvar/ColvarDRMSD.cpp
+++ b/src/colvar/ColvarDRMSD.cpp
@@ -29,6 +29,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR DRMSD
 /*
@@ -73,28 +74,28 @@ DRMSD REFERENCE=file.pdb LOWER_CUTOFF=0.1 UPPER_CUTOFF=0.8
 //+ENDPLUMEDOC
 
    
-class ColvarDRMSD : public Colvar {
+class DRMSD : public Colvar {
 	
   vector<Vector> derivs_;
-  DRMSD drmsd_;
+  PLMD::DRMSD drmsd_;
   bool pbc_;
 
 public:
-  ColvarDRMSD(const ActionOptions&);
+  DRMSD(const ActionOptions&);
   virtual void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(ColvarDRMSD,"DRMSD")
+PLUMED_REGISTER_ACTION(DRMSD,"DRMSD")
 
-void ColvarDRMSD::registerKeywords(Keywords& keys){
+void DRMSD::registerKeywords(Keywords& keys){
   Colvar::registerKeywords(keys);
   keys.add("compulsory","REFERENCE","a file in pdb format containing the reference structure and the atoms involved in the CV.");
   keys.add("compulsory","LOWER_CUTOFF","only pairs of atoms further than LOWER_CUTOFF are considered in the calculation.");
   keys.add("compulsory","UPPER_CUTOFF","only pairs of atoms closer than UPPER_CUTOFF are considered in the calculation.");
 }
 
-ColvarDRMSD::ColvarDRMSD(const ActionOptions&ao):
+DRMSD::DRMSD(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao), pbc_(true)
 {
   string reference;
@@ -128,7 +129,7 @@ PLUMED_COLVAR_INIT(ao), pbc_(true)
 }
 
 // calculator
-void ColvarDRMSD::calculate(){
+void DRMSD::calculate(){
 
 // set derivatives to zero
  for(unsigned i=0;i<derivs_.size();++i) {derivs_[i].zero();}
@@ -148,3 +149,4 @@ void ColvarDRMSD::calculate(){
  }
 
 }
+}
diff --git a/src/colvar/ColvarDipole.cpp b/src/colvar/ColvarDipole.cpp
index 66fcd7ed79dd1f492618b6c71c803bc10a08f40f..c170930c3059fb8160de6e3490355e848fbbb22c 100644
--- a/src/colvar/ColvarDipole.cpp
+++ b/src/colvar/ColvarDipole.cpp
@@ -28,6 +28,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR DIPOLE 
 /*
@@ -51,23 +52,23 @@ on the position) is computed on the geometric center of the group.
 */
 //+ENDPLUMEDOC
    
-class ColvarDipole : public Colvar {
+class Dipole : public Colvar {
   vector<AtomNumber> ga_lista;
 public:
-  ColvarDipole(const ActionOptions&);
+  Dipole(const ActionOptions&);
   virtual void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(ColvarDipole,"DIPOLE")
+PLUMED_REGISTER_ACTION(Dipole,"DIPOLE")
 
-void ColvarDipole::registerKeywords(Keywords& keys){
+void Dipole::registerKeywords(Keywords& keys){
   Colvar::registerKeywords(keys);
   keys.add("atoms","GROUP","the group of atoms we are calculating the dipole moment for");
   keys.remove("NOPBC");
 }
 
-ColvarDipole::ColvarDipole(const ActionOptions&ao):
+Dipole::Dipole(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao)
 {
   parseAtomList("GROUP",ga_lista);
@@ -83,7 +84,7 @@ PLUMED_COLVAR_INIT(ao)
 }
 
 // calculator
-void ColvarDipole::calculate()
+void Dipole::calculate()
 {
  double dipole=0.;
  Tensor virial;
@@ -121,3 +122,4 @@ void ColvarDipole::calculate()
 }
 
 }
+}
diff --git a/src/colvar/ColvarDistance.cpp b/src/colvar/ColvarDistance.cpp
index 4eb74602c312c561f399b0cc6eae1fa98262429b..7758d74d34014d18e46bc907c5765e3bf45d6f66 100644
--- a/src/colvar/ColvarDistance.cpp
+++ b/src/colvar/ColvarDistance.cpp
@@ -29,6 +29,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR DISTANCE
 /*
@@ -48,26 +49,26 @@ PRINT ARG=d1,d2,d2.x
 */
 //+ENDPLUMEDOC
    
-class ColvarDistance : public Colvar {
+class Distance : public Colvar {
   bool components;
   bool pbc;
 
 public:
   static void registerKeywords( Keywords& keys );
-  ColvarDistance(const ActionOptions&);
+  Distance(const ActionOptions&);
 // active methods:
   virtual void calculate();
 };
 
-PLUMED_REGISTER_ACTION(ColvarDistance,"DISTANCE")
+PLUMED_REGISTER_ACTION(Distance,"DISTANCE")
 
-void ColvarDistance::registerKeywords( Keywords& keys ){
+void Distance::registerKeywords( Keywords& keys ){
   Colvar::registerKeywords( keys );
   keys.add("atoms","ATOMS","the pair of atom that we are calculating the distance between");
   keys.addFlag("COMPONENTS",false,"calculate the x, y and z components of the distance separately and store them as label.x, label.y and label.z");  
 }
 
-ColvarDistance::ColvarDistance(const ActionOptions&ao):
+Distance::Distance(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 components(false),
 pbc(true)
@@ -101,7 +102,7 @@ pbc(true)
 
 
 // calculator
-void ColvarDistance::calculate(){
+void Distance::calculate(){
 
   Vector distance;
   if(pbc){
@@ -143,6 +144,7 @@ void ColvarDistance::calculate(){
 }
 
 }
+}
 
 
 
diff --git a/src/colvar/ColvarEnergy.cpp b/src/colvar/ColvarEnergy.cpp
index b07a314db2a5c36b3d58d87875fa7444bfc8256d..8948ec55fa5ab156d658f14416c86427d93e1340 100644
--- a/src/colvar/ColvarEnergy.cpp
+++ b/src/colvar/ColvarEnergy.cpp
@@ -29,6 +29,7 @@
 #include <cassert>
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR ENERGY
 /*
@@ -48,11 +49,11 @@ PRINT ARG=ene
 //+ENDPLUMEDOC
 
 
-class ColvarEnergy : public Colvar {
+class Energy : public Colvar {
   bool components;
 
 public:
-  ColvarEnergy(const ActionOptions&);
+  Energy(const ActionOptions&);
 // active methods:
   void prepare();
   virtual void calculate();
@@ -63,9 +64,9 @@ public:
 using namespace std;
 
 
-PLUMED_REGISTER_ACTION(ColvarEnergy,"ENERGY")
+PLUMED_REGISTER_ACTION(Energy,"ENERGY")
 
-ColvarEnergy::ColvarEnergy(const ActionOptions&ao):
+Energy::Energy(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 components(false)
 {
@@ -75,24 +76,25 @@ components(false)
   getPntrToValue()->resizeDerivatives(1);
 }
 
-void ColvarEnergy::registerKeywords( Keywords& keys ){
+void Energy::registerKeywords( Keywords& keys ){
   Action::registerKeywords( keys );
   ActionAtomistic::registerKeywords( keys );
   ActionWithValue::registerKeywords( keys );
   keys.remove("NUMERICAL_DERIVATIVES"); 
 }
 
-void ColvarEnergy::prepare(){
+void Energy::prepare(){
   plumed.getAtoms().setCollectEnergy(true);
 }
 
 // calculator
-void ColvarEnergy::calculate(){
+void Energy::calculate(){
   setValue( getEnergy() );
   getPntrToComponent(0)->addDerivative(0,1.0);
 }
 
 }
+}
 
 
 
diff --git a/src/colvar/ColvarGyration.cpp b/src/colvar/ColvarGyration.cpp
index 566a5829beecfc19ed2e2071efe0f7998cf24802..199349b3f9df89d02d0044242daad1779c8d2c5f 100644
--- a/src/colvar/ColvarGyration.cpp
+++ b/src/colvar/ColvarGyration.cpp
@@ -70,7 +70,7 @@ PRINT ARG=rg STRIDE=1 FILE=colvar
 */
 //+ENDPLUMEDOC
 
-class ColvarGyration : public Colvar {
+class Gyration : public Colvar {
 private:
   std::string Type;
   enum CV_TYPE {RADIUS, TRACE, GTPC_1, GTPC_2, GTPC_3, ASPHERICITY, ACYLINDRICITY, KAPPA2, GYRATION_3, GYRATION_2, GYRATION_1, TOT};
@@ -78,20 +78,20 @@ private:
   bool use_masses;
 public:
   static void registerKeywords( Keywords& keys );
-  ColvarGyration(const ActionOptions&);
+  Gyration(const ActionOptions&);
   virtual void calculate();
 };
 
-PLUMED_REGISTER_ACTION(ColvarGyration,"GYRATION")
+PLUMED_REGISTER_ACTION(Gyration,"GYRATION")
 
-void ColvarGyration::registerKeywords( Keywords& keys ){
+void Gyration::registerKeywords( Keywords& keys ){
   Colvar::registerKeywords( keys );
   keys.add("compulsory","TYPE","RADIUS","The type of calculation relative to the Gyration Tensor you want to perform");
   keys.add("atoms","ATOMS","the group of atoms that you are calculating the Gyration Tensor for");
   keys.addFlag("NOT_MASS_WEIGHTED",false,"set the masses of all the atoms equal to one");
 }
 
-ColvarGyration::ColvarGyration(const ActionOptions&ao):
+Gyration::Gyration(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 use_masses(true)
 {
@@ -141,7 +141,7 @@ use_masses(true)
   requestAtoms(atoms);
 }
 
-void ColvarGyration::calculate(){
+void Gyration::calculate(){
 
   std::vector<Vector> derivatives( getNumberOfAtoms() );
   Tensor virial; virial.zero();
diff --git a/src/colvar/ColvarPathMSD.cpp b/src/colvar/ColvarPathMSD.cpp
index 4ca4bf0f0acbe5daece3a57f80aae72109321302..e574362adbb0bd5ae707463eb19a0fccb2099dbc 100644
--- a/src/colvar/ColvarPathMSD.cpp
+++ b/src/colvar/ColvarPathMSD.cpp
@@ -25,6 +25,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR PATHMSD
 /*
@@ -68,20 +69,20 @@ END
 */
 //+ENDPLUMEDOC
    
-class ColvarPathMSD : public ColvarPathMSDBase {
+class PathMSD : public PathMSDBase {
 public:
-  ColvarPathMSD(const ActionOptions&);
+  PathMSD(const ActionOptions&);
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(ColvarPathMSD,"PATHMSD")
+PLUMED_REGISTER_ACTION(PathMSD,"PATHMSD")
 
-void ColvarPathMSD::registerKeywords(Keywords& keys){
-  ColvarPathMSDBase::registerKeywords(keys);
+void PathMSD::registerKeywords(Keywords& keys){
+  PathMSDBase::registerKeywords(keys);
 }
 
-ColvarPathMSD::ColvarPathMSD(const ActionOptions&ao):
-Action(ao),ColvarPathMSDBase(ao)
+PathMSD::PathMSD(const ActionOptions&ao):
+Action(ao),PathMSDBase(ao)
 {
   checkRead();
 
@@ -102,3 +103,4 @@ Action(ao),ColvarPathMSDBase(ao)
 
 }
 
+}
diff --git a/src/colvar/ColvarPathMSDBase.cpp b/src/colvar/ColvarPathMSDBase.cpp
index 7c291ddcaf138daa09e8a3c506ed876bc58f11c2..80b41fd6f1e7e6a572e11684e6292bbfae9c0d77 100644
--- a/src/colvar/ColvarPathMSDBase.cpp
+++ b/src/colvar/ColvarPathMSDBase.cpp
@@ -39,8 +39,9 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
-void ColvarPathMSDBase::registerKeywords(Keywords& keys){
+void PathMSDBase::registerKeywords(Keywords& keys){
   Colvar::registerKeywords(keys);
   keys.add("compulsory","LAMBDA","the lambda parameter is needed for smoothing, is in the units of plumed");
   keys.add("compulsory","REFERENCE","the pdb is needed to provide the various milestones");
@@ -48,7 +49,7 @@ void ColvarPathMSDBase::registerKeywords(Keywords& keys){
   keys.add("optional","NEIGH_STRIDE","how often the neighbor list needs to be calculated in time units");
 }
 
-ColvarPathMSDBase::ColvarPathMSDBase(const ActionOptions&ao):
+PathMSDBase::PathMSDBase(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 pbc(true),
 neigh_size(-1),
@@ -99,7 +100,7 @@ nframes(0)
 
 }
 
-void ColvarPathMSDBase::calculate(){
+void PathMSDBase::calculate(){
 
   //log.printf("NOW CALCULATE! \n");
 
@@ -185,3 +186,4 @@ void ColvarPathMSDBase::calculate(){
 
 }
 
+}
diff --git a/src/colvar/ColvarPathMSDBase.h b/src/colvar/ColvarPathMSDBase.h
index 7882e1cb5391065a5387c17f5227fa4ecda515df..6fe8b70087d43b15401cdb99b4840b7ad6ef0a01 100644
--- a/src/colvar/ColvarPathMSDBase.h
+++ b/src/colvar/ColvarPathMSDBase.h
@@ -38,8 +38,9 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
-class ColvarPathMSDBase : public Colvar {
+class PathMSDBase : public Colvar {
 /// this class is a general container for path stuff 
   class ImagePath {
      public:
@@ -82,13 +83,14 @@ protected:
   vector< vector<double> > indexvec; // use double to allow isomaps
   unsigned nframes;
 public:
-  ColvarPathMSDBase(const ActionOptions&);
+  PathMSDBase(const ActionOptions&);
 // active methods:
   virtual void calculate();
 //  virtual void prepare();
   static void registerKeywords(Keywords& keys);
 };
 
+}
 }
 
 #endif
diff --git a/src/colvar/ColvarPropertyMap.cpp b/src/colvar/ColvarPropertyMap.cpp
index 8007cd8ceca3735cb4562a34268cb981643d0f96..f7caa594191f9862a3d93b5a209c8c4b9ae9386a 100644
--- a/src/colvar/ColvarPropertyMap.cpp
+++ b/src/colvar/ColvarPropertyMap.cpp
@@ -25,6 +25,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR PROPERTYMAP 
 /*
@@ -69,22 +70,22 @@ END
 */
 //+ENDPLUMEDOC
    
-class ColvarPropertyMap : public ColvarPathMSDBase {
+class PropertyMap : public PathMSDBase {
 public:
-  ColvarPropertyMap(const ActionOptions&);
+  PropertyMap(const ActionOptions&);
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(ColvarPropertyMap,"PROPERTYMAP")
+PLUMED_REGISTER_ACTION(PropertyMap,"PROPERTYMAP")
 
-void ColvarPropertyMap::registerKeywords(Keywords& keys){
-  ColvarPathMSDBase::registerKeywords(keys);
+void PropertyMap::registerKeywords(Keywords& keys){
+  PathMSDBase::registerKeywords(keys);
   keys.add("compulsory","PROPERTY","the property to be used in the indexing: this goes in the REMARK field of the reference");
 }
 
-ColvarPropertyMap::ColvarPropertyMap(const ActionOptions&ao):
+PropertyMap::PropertyMap(const ActionOptions&ao):
 Action(ao),
-ColvarPathMSDBase(ao)
+PathMSDBase(ao)
 {
   // this is the only additional keyword needed 
   parseVector("PROPERTY",labels);
@@ -126,5 +127,6 @@ ColvarPathMSDBase(ao)
 }
 
 }
+}
 
 
diff --git a/src/colvar/ColvarRMSD.cpp b/src/colvar/ColvarRMSD.cpp
index 6b3b801cb277979bd6491a211f63434380b1e325..15ec6e651820faefaabfc7a9d41a9462f7151705 100644
--- a/src/colvar/ColvarRMSD.cpp
+++ b/src/colvar/ColvarRMSD.cpp
@@ -30,28 +30,25 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
    
-class ColvarRMSD : public Colvar {
+class RMSD : public Colvar {
 	
-  RMSD rmsd;
+  PLMD::RMSD rmsd;
 	
   bool squared; 
 
   vector<Vector> derivs;
 
 public:
-  ColvarRMSD(const ActionOptions&);
+  RMSD(const ActionOptions&);
   virtual void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-}
-
 
 using namespace std;
 
-namespace PLMD{
-
 //+PLUMEDOC COLVAR RMSD
 /*
 Calculate the RMSD with respect to a reference structure.  
@@ -110,16 +107,16 @@ RMSD REFERENCE=file.pdb TYPE=OPTIMAL
 */
 //+ENDPLUMEDOC
 
-PLUMED_REGISTER_ACTION(ColvarRMSD,"RMSD")
+PLUMED_REGISTER_ACTION(RMSD,"RMSD")
 
-void ColvarRMSD::registerKeywords(Keywords& keys){
+void RMSD::registerKeywords(Keywords& keys){
   Colvar::registerKeywords(keys);
   keys.add("compulsory","REFERENCE","a file in pdb format containing the reference structure and the atoms involved in the CV.");
   keys.add("compulsory","TYPE","SIMPLE","the manner in which RMSD alignment is performed.  Should be OPTIMAL or SIMPLE.");
   keys.addFlag("SQUARED",false," This should be setted if you want MSD instead of RMSD ");
 }
 
-ColvarRMSD::ColvarRMSD(const ActionOptions&ao):
+RMSD::RMSD(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),rmsd(log),squared(false)
 {
   string reference;
@@ -153,7 +150,7 @@ PLUMED_COLVAR_INIT(ao),rmsd(log),squared(false)
 
 
 // calculator
-void ColvarRMSD::calculate(){
+void RMSD::calculate(){
   double r=rmsd.calculate(getPositions(),derivs,squared);
   setValue(r);
   for(unsigned i=0;i<derivs.size();i++) setAtomsDerivatives(i,derivs[i]);
@@ -163,6 +160,7 @@ void ColvarRMSD::calculate(){
 }
 
 }
+}
 
 
 
diff --git a/src/colvar/ColvarTemplate.cpp b/src/colvar/ColvarTemplate.cpp
index 8332342e71c0b09932dc674ac47096d62a1bcacc..8a251daf090255800ea64f6f1a88474948349823 100644
--- a/src/colvar/ColvarTemplate.cpp
+++ b/src/colvar/ColvarTemplate.cpp
@@ -29,6 +29,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR TEMPLATE
 /*
@@ -43,19 +44,19 @@ This file provides a template for if you want to introduce a new CV.
 */
 //+ENDPLUMEDOC
    
-class ColvarTemplate : public Colvar {
+class Template : public Colvar {
   bool pbc;
 
 public:
-  ColvarTemplate(const ActionOptions&);
+  Template(const ActionOptions&);
 // active methods:
   virtual void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(ColvarTemplate,"TEMPLATE")
+PLUMED_REGISTER_ACTION(Template,"TEMPLATE")
 
-void ColvarTemplate::registerKeywords(Keywords& keys){
+void Template::registerKeywords(Keywords& keys){
   Colvar::registerKeywords(keys);
   keys.addFlag("TEMPLATE_DEFAULT_OFF_FLAG",false,"flags that are by default not performed should be specified like this");
   keys.addFlag("TEMPLATE_DEFAULT_ON_FLAG",true,"flags that are by default performed should be specified like this");
@@ -64,7 +65,7 @@ void ColvarTemplate::registerKeywords(Keywords& keys){
   keys.add("atoms","TEMPLATE_INPUT","the keyword with which you specify what atoms to use should be added like this");
 }
 
-ColvarTemplate::ColvarTemplate(const ActionOptions&ao):
+Template::Template(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 pbc(true)
 {
@@ -87,7 +88,7 @@ pbc(true)
 
 
 // calculator
-void ColvarTemplate::calculate(){
+void Template::calculate(){
 
   Vector distance;
   if(pbc){
@@ -105,6 +106,7 @@ void ColvarTemplate::calculate(){
 }
 
 }
+}
 
 
 
diff --git a/src/colvar/ColvarTorsion.cpp b/src/colvar/ColvarTorsion.cpp
index 56134dee1bfdd7b1e837cf16990380b6a8de2433..88b84ad10e6459c8d80a568f7fed826f393b1bf7 100644
--- a/src/colvar/ColvarTorsion.cpp
+++ b/src/colvar/ColvarTorsion.cpp
@@ -30,6 +30,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR TORSION
 /*
@@ -56,20 +57,20 @@ TORSION VECTOR1=2,1 AXIS=2,3 VECTOR2=3,4
 */
 //+ENDPLUMEDOC
    
-class ColvarTorsion : public Colvar {
+class Torsion : public Colvar {
   bool pbc;
   bool do_cosine;
 
 public:
-  ColvarTorsion(const ActionOptions&);
+  Torsion(const ActionOptions&);
 // active methods:
   virtual void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(ColvarTorsion,"TORSION")
+PLUMED_REGISTER_ACTION(Torsion,"TORSION")
 
-void ColvarTorsion::registerKeywords(Keywords& keys){
+void Torsion::registerKeywords(Keywords& keys){
    Colvar::registerKeywords( keys );
    keys.add("atoms-1","ATOMS","the four atoms involved in the torsional angle");
    keys.add("atoms-2","AXIS","two atoms that define an axis.  You can use this to find the angle in the plane perpendicular to the axis between the vectors specified using the VECTOR1 and VECTOR2 keywords."); 
@@ -78,7 +79,7 @@ void ColvarTorsion::registerKeywords(Keywords& keys){
    keys.addFlag("COSINE",false,"calculate cosine instead of dihedral");
 }
 
-ColvarTorsion::ColvarTorsion(const ActionOptions&ao):
+Torsion::Torsion(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 pbc(true),
 do_cosine(false)
@@ -129,7 +130,7 @@ do_cosine(false)
 }
 
 // calculator
-void ColvarTorsion::calculate(){
+void Torsion::calculate(){
 
   Vector d0,d1,d2;
   if(pbc){
@@ -142,7 +143,7 @@ void ColvarTorsion::calculate(){
     d2=delta(getPosition(5),getPosition(4));
   }
   Vector dd0,dd1,dd2;
-  Torsion t;
+  PLMD::Torsion t;
   double torsion=t.compute(d0,d1,d2,dd0,dd1,dd2);
   if(do_cosine){
    dd0 *= -sin(torsion);
@@ -162,6 +163,7 @@ void ColvarTorsion::calculate(){
 }
 
 }
+}
 
 
 
diff --git a/src/colvar/ColvarVolume.cpp b/src/colvar/ColvarVolume.cpp
index ba5328977cd283c350e4541fcd43e1db36c2e40f..45ab1953549fe8e11d6392c2a0e0b65c679b7ea7 100644
--- a/src/colvar/ColvarVolume.cpp
+++ b/src/colvar/ColvarVolume.cpp
@@ -29,6 +29,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace colvar{
 
 //+PLUMEDOC COLVAR VOLUME
 /*
@@ -46,20 +47,20 @@ PRINT ARG=vol
 //+ENDPLUMEDOC
 
 
-class ColvarVolume : public Colvar {
+class Volume : public Colvar {
   bool components;
 
 public:
-  ColvarVolume(const ActionOptions&);
+  Volume(const ActionOptions&);
 // active methods:
   virtual void calculate();
 /// Register all the keywords for this action
   static void registerKeywords( Keywords& keys );
 };
 
-PLUMED_REGISTER_ACTION(ColvarVolume,"VOLUME")
+PLUMED_REGISTER_ACTION(Volume,"VOLUME")
 
-ColvarVolume::ColvarVolume(const ActionOptions&ao):
+Volume::Volume(const ActionOptions&ao):
 PLUMED_COLVAR_INIT(ao),
 components(false)
 {
@@ -74,7 +75,7 @@ components(false)
   requestAtoms(atoms);
 }
 
-void ColvarVolume::registerKeywords( Keywords& keys ){
+void Volume::registerKeywords( Keywords& keys ){
   Action::registerKeywords( keys );
   ActionWithValue::registerKeywords( keys );
   ActionAtomistic::registerKeywords( keys );
@@ -84,7 +85,7 @@ void ColvarVolume::registerKeywords( Keywords& keys ){
 
 
 // calculator
-void ColvarVolume::calculate(){
+void Volume::calculate(){
   if(components){
 // todo
   };
@@ -94,6 +95,7 @@ void ColvarVolume::calculate(){
 }
 
 }
+}
 
 
 
diff --git a/src/core/CLTool.h b/src/core/CLTool.h
index abe404a31490669be818cf12c0a4456874e10c93..7629b602a9ab0997268beb9b7cf5c167fd461bc9 100644
--- a/src/core/CLTool.h
+++ b/src/core/CLTool.h
@@ -52,10 +52,6 @@ is \ref AddingACLTool "information" as to how to go about implemneting a new too
 */
 
 class CLTool {
-// This is a fried so we can create input data quickly
-// when you do debug-float. 
-template <typename real>
-friend class CLToolDriver;
 private:
 /// The name of this command line tool
   const std::string name;
@@ -69,6 +65,14 @@ private:
   bool readInputFile( int argc, char**argv, FILE* in, FILE*out );
 /// Set arguments from the default options provided to Keywords
   void setRemainingToDefault(FILE* out);
+public:
+/// Set the input data:
+  void setInputData(const std::map<std::string,std::string>&inputData){
+    this->inputData=inputData;
+  }
+  const std::map<std::string,std::string>&getInputData(){
+    return this->inputData;
+  }
 protected:
 /// Get the value of one of the command line arguments 
   template<class T>
diff --git a/src/function/Function.cpp b/src/function/Function.cpp
index 75e3ec1a687e380fe6094e70b09e66a08f43d853..8612cc6d305522099693ad7e3111c822d093646e 100644
--- a/src/function/Function.cpp
+++ b/src/function/Function.cpp
@@ -22,6 +22,7 @@
 #include "Function.h"
 
 using namespace PLMD;
+using namespace PLMD::function;
 using namespace std;
 
 void Function::registerKeywords(Keywords& keys){
diff --git a/src/function/Function.h b/src/function/Function.h
index f7e7445d2736b9bd45ad517139d8566b41a36c1f..a11f12ca084d3837657a01fcdcb441980ce3cfeb 100644
--- a/src/function/Function.h
+++ b/src/function/Function.h
@@ -26,6 +26,7 @@
 #include "core/ActionWithArguments.h"
 
 namespace PLMD{
+namespace function{
 
 /**
 \ingroup INHERIT
@@ -59,6 +60,7 @@ void Function::setDerivative(int i,double d){
   setDerivative(getPntrToValue(),i,d);
 }
 
+}
 }
 
 #endif
diff --git a/src/function/FunctionCombine.cpp b/src/function/FunctionCombine.cpp
index 59eb6df3918b7b90f9027f3e05a5bcc9ec450952..f2776345fba899c51ce898a36e547368d5a88da4 100644
--- a/src/function/FunctionCombine.cpp
+++ b/src/function/FunctionCombine.cpp
@@ -28,6 +28,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace function{
 
 //+PLUMEDOC FUNCTION COMBINE
 /*
@@ -50,22 +51,22 @@ PRINT ARG=distance,distance2
 //+ENDPLUMEDOC
 
 
-class FunctionCombine :
+class Combine :
   public Function
 {
   bool normalize;
   std::vector<double> coefficients;
   std::vector<double> powers;
 public:
-  FunctionCombine(const ActionOptions&);
+  Combine(const ActionOptions&);
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
 
-PLUMED_REGISTER_ACTION(FunctionCombine,"COMBINE")
+PLUMED_REGISTER_ACTION(Combine,"COMBINE")
 
-void FunctionCombine::registerKeywords(Keywords& keys){
+void Combine::registerKeywords(Keywords& keys){
   Function::registerKeywords(keys);
   keys.use("ARG"); keys.use("PERIODIC");
   keys.add("compulsory","COEFFICIENTS","1.0","the coefficients of the arguments in your function");
@@ -73,7 +74,7 @@ void FunctionCombine::registerKeywords(Keywords& keys){
   keys.addFlag("NORMALIZE",false,"normalize all the coefficents so that in total they are equal to one");
 }
 
-FunctionCombine::FunctionCombine(const ActionOptions&ao):
+Combine::Combine(const ActionOptions&ao):
 Action(ao),
 Function(ao),
 normalize(false),
@@ -104,7 +105,7 @@ powers(getNumberOfArguments(),1.0)
   log.printf("\n");
 }
 
-void FunctionCombine::calculate(){
+void Combine::calculate(){
   double combine=0.0;
   for(unsigned i=0;i<coefficients.size();++i){
     combine+=coefficients[i]*pow(getArgument(i),powers[i]);
@@ -114,5 +115,6 @@ void FunctionCombine::calculate(){
 }
 
 }
+}
 
 
diff --git a/src/function/FunctionFuncPathMSD.cpp b/src/function/FunctionFuncPathMSD.cpp
index 2d239ff227cd9ff31541f9763b6ab109325c50dd..47f985401fac0637ae7bff079be02acf8d40a5b8 100644
--- a/src/function/FunctionFuncPathMSD.cpp
+++ b/src/function/FunctionFuncPathMSD.cpp
@@ -33,6 +33,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace function{
 
 //+PLUMEDOC FUNCTION FUNCPATHMSD
 /*
@@ -61,7 +62,7 @@ PRINT ARG=t1,t2,t3,p1.s,p1.z STRIDE=1 FILE=colvar FMT=%8.4f
 */
 //+ENDPLUMEDOC
    
-class FunctionFuncPathMSD : public Function {
+class FuncPathMSD : public Function {
   double lambda;
   bool pbc;
   int neigh_size;
@@ -106,23 +107,23 @@ struct pairordering {
 };
 
 public:
-  FunctionFuncPathMSD(const ActionOptions&);
+  FuncPathMSD(const ActionOptions&);
 // active methods:
   virtual void calculate();
   virtual void prepare();
   static void registerKeywords(Keywords& keys);
 };
 
-PLUMED_REGISTER_ACTION(FunctionFuncPathMSD,"FUNCPATHMSD")
+PLUMED_REGISTER_ACTION(FuncPathMSD,"FUNCPATHMSD")
 
-void FunctionFuncPathMSD::registerKeywords(Keywords& keys){
+void FuncPathMSD::registerKeywords(Keywords& keys){
   Function::registerKeywords(keys);
   keys.use("ARG");
   keys.add("compulsory","LAMBDA","all compulsory keywords should be added like this with a description here");
   keys.add("optional","NEIGH_SIZE","all optional keywords that have input should be added like a description here");
   keys.add("optional","NEIGH_STRIDE","all optional keywords that have input should be added like a description here");
 }
-FunctionFuncPathMSD::FunctionFuncPathMSD(const ActionOptions&ao):
+FuncPathMSD::FuncPathMSD(const ActionOptions&ao):
 Action(ao),
 Function(ao),
 pbc(true),
@@ -171,7 +172,7 @@ neigh_stride(-1.)
   
 }
 // calculator
-void FunctionFuncPathMSD::calculate(){
+void FuncPathMSD::calculate(){
  // log.printf("NOW CALCULATE! \n");
   double s_path=0.;
   double partition=0.;
@@ -207,7 +208,7 @@ void FunctionFuncPathMSD::calculate(){
 ///
 /// this function updates the needed argument list
 ///
-void FunctionFuncPathMSD::prepare(){
+void FuncPathMSD::prepare(){
 
   // neighbor list: rank and activate the chain for the next step 
 
@@ -265,5 +266,6 @@ void FunctionFuncPathMSD::prepare(){
 }
 
 }
+}
 
 
diff --git a/src/function/FunctionMatheval.cpp b/src/function/FunctionMatheval.cpp
index 588e321eb87c0ad20396f8a3a87376b319725c59..5922b7e94e7d8688de8100517763076d1ad0a527 100644
--- a/src/function/FunctionMatheval.cpp
+++ b/src/function/FunctionMatheval.cpp
@@ -30,6 +30,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace function{
 
 
 //+PLUMEDOC FUNCTION MATHEVAL
@@ -62,7 +63,7 @@ PLUMED has been linked to it
 //+ENDPLUMEDOC
 
 
-class FunctionMatheval :
+class Matheval :
   public Function
 {
   void* evaluator;
@@ -72,23 +73,23 @@ class FunctionMatheval :
   vector<double> values;
   vector<char*> names;
 public:
-  FunctionMatheval(const ActionOptions&);
-  ~FunctionMatheval();
+  Matheval(const ActionOptions&);
+  ~Matheval();
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
 #ifdef __PLUMED_HAS_MATHEVAL
-PLUMED_REGISTER_ACTION(FunctionMatheval,"MATHEVAL")
+PLUMED_REGISTER_ACTION(Matheval,"MATHEVAL")
 
-void FunctionMatheval::registerKeywords(Keywords& keys){
+void Matheval::registerKeywords(Keywords& keys){
   Function::registerKeywords(keys);
   keys.use("ARG"); keys.use("PERIODIC");
   keys.add("compulsory","FUNC","the function you wish to evaluate");
   keys.add("optional","VAR","the names to give each of the arguments in the function.  If you have up to three arguments in your function you can use x, y and z to refer to them.  Otherwise you must use this flag to give your variables names.");
 }
 
-FunctionMatheval::FunctionMatheval(const ActionOptions&ao):
+Matheval::Matheval(const ActionOptions&ao):
 Action(ao),
 Function(ao),
 evaluator_deriv(getNumberOfArguments()),
@@ -132,7 +133,7 @@ names(getNumberOfArguments())
   log.printf("\n");
 }
 
-void FunctionMatheval::calculate(){
+void Matheval::calculate(){
   for(unsigned i=0;i<getNumberOfArguments();i++) values[i]=getArgument(i);
   for(unsigned i=0;i<getNumberOfArguments();i++) names[i]=const_cast<char*>(var[i].c_str());
   setValue(evaluator_evaluate(evaluator,names.size(),&names[0],&values[0]));
@@ -142,7 +143,7 @@ void FunctionMatheval::calculate(){
   }
 }
 
-FunctionMatheval::~FunctionMatheval(){
+Matheval::~Matheval(){
   evaluator_destroy(evaluator);
   for(unsigned i=0;i<evaluator_deriv.size();i++)evaluator_destroy(evaluator_deriv[i]);
 }
@@ -150,5 +151,6 @@ FunctionMatheval::~FunctionMatheval(){
 #endif
 
 }
+}
 
 
diff --git a/src/function/FunctionPiecewise.cpp b/src/function/FunctionPiecewise.cpp
index d054ab12a4759b19e22851ddca9358a7b6dcc1c5..d9b4816cd3f479ab26eec3a89c2af03ed95cdfb8 100644
--- a/src/function/FunctionPiecewise.cpp
+++ b/src/function/FunctionPiecewise.cpp
@@ -28,6 +28,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace function{
 
 //+PLUMEDOC FUNCTION PIECEWISE
 /*
@@ -69,28 +70,28 @@ PRINT ARG=pw,ppww.1,ppww.2
 //+ENDPLUMEDOC
 
 
-class FunctionPiecewise :
+class Piecewise :
   public Function
 {
   bool normalize;
   std::vector<std::pair<double,double> > points;
 public:
-  FunctionPiecewise(const ActionOptions&);
+  Piecewise(const ActionOptions&);
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
 
-PLUMED_REGISTER_ACTION(FunctionPiecewise,"PIECEWISE")
+PLUMED_REGISTER_ACTION(Piecewise,"PIECEWISE")
 
-void FunctionPiecewise::registerKeywords(Keywords& keys){
+void Piecewise::registerKeywords(Keywords& keys){
   Function::registerKeywords(keys);
   keys.use("ARG");
   keys.add("numbered","POINT","This keyword is used to specify the various points in the function above.");
   keys.reset_style("POINT","compulsory");
 }
 
-FunctionPiecewise::FunctionPiecewise(const ActionOptions&ao):
+Piecewise::Piecewise(const ActionOptions&ao):
 Action(ao),
 Function(ao)
 {
@@ -123,7 +124,7 @@ Function(ao)
   log.printf("\n");
 }
 
-void FunctionPiecewise::calculate(){
+void Piecewise::calculate(){
   for(int i=0;i<getNumberOfArguments();i++){
     double val=getArgument(i);
     int p=0;
@@ -154,5 +155,6 @@ void FunctionPiecewise::calculate(){
 }
 
 }
+}
 
 
diff --git a/src/function/FunctionSort.cpp b/src/function/FunctionSort.cpp
index c726744affef630862630c30beb89b94616559eb..ce4e8f7938aeb98dd3a9c2aec70872d6d6e05599 100644
--- a/src/function/FunctionSort.cpp
+++ b/src/function/FunctionSort.cpp
@@ -30,6 +30,7 @@
 using namespace std;
 
 namespace PLMD{
+namespace function{
 
 //+PLUMEDOC FUNCTION SORT
 /*
@@ -52,24 +53,24 @@ PRINT ARG=sort.1,sort.4
 //+ENDPLUMEDOC
 
 
-class FunctionSort :
+class Sort :
   public Function
 {
 public:
-  FunctionSort(const ActionOptions&);
+  Sort(const ActionOptions&);
   void calculate();
   static void registerKeywords(Keywords& keys);
 };
 
 
-PLUMED_REGISTER_ACTION(FunctionSort,"SORT")
+PLUMED_REGISTER_ACTION(Sort,"SORT")
 
-void FunctionSort::registerKeywords(Keywords& keys){
+void Sort::registerKeywords(Keywords& keys){
   Function::registerKeywords(keys);
   keys.use("ARG");
 }
 
-FunctionSort::FunctionSort(const ActionOptions&ao):
+Sort::Sort(const ActionOptions&ao):
 Action(ao),
 Function(ao)
 {
@@ -85,7 +86,7 @@ Function(ao)
 
 }
 
-void FunctionSort::calculate(){
+void Sort::calculate(){
   vector<pair<double,int> > vals(getNumberOfArguments());
   for(unsigned i=0;i<getNumberOfArguments();++i){
     vals[i].first=getArgument(i);
@@ -102,5 +103,6 @@ void FunctionSort::calculate(){
 }
 
 }
+}
 
 
diff --git a/src/function/FunctionTarget.cpp b/src/function/FunctionTarget.cpp
index d8b085fcf9c4d080823399c009ca72b1e935ee31..e2ad798b28aaeafcb380862ab729e73e3a534446 100644
--- a/src/function/FunctionTarget.cpp
+++ b/src/function/FunctionTarget.cpp
@@ -29,6 +29,7 @@
 using namespace std;
 
 namespace PLMD {
+namespace function{
 
 //+PLUMEDOC FUNCTION TARGET
 /*
@@ -41,19 +42,19 @@ set of collective variables.
 */
 //+ENDPLUMEDOC
 
-class FunctionTarget : public Function {
+class Target : public Function {
 private:
   TargetDist target;
   std::vector<double> derivs;
 public:
-  FunctionTarget(const ActionOptions&);
+  Target(const ActionOptions&);
   virtual void calculate();
   static void registerKeywords(Keywords& keys );
 };
 
-PLUMED_REGISTER_ACTION(FunctionTarget,"TARGET")
+PLUMED_REGISTER_ACTION(Target,"TARGET")
 
-void FunctionTarget::registerKeywords(Keywords& keys){
+void Target::registerKeywords(Keywords& keys){
   Function::registerKeywords(keys);
   keys.use("ARG");
   keys.add("compulsory","REFERENCE","a file in pdb format containing the reference structure. In the PDB file the atomic "
@@ -64,7 +65,7 @@ void FunctionTarget::registerKeywords(Keywords& keys){
   keys.add("optional","REFERENCE_VEC","the vector of values for the CVs at the reference point (if you use this you don't need REFERENCE)");
 }
 
-FunctionTarget::FunctionTarget(const ActionOptions&ao):
+Target::Target(const ActionOptions&ao):
 Action(ao),
 Function(ao),
 target(log)
@@ -87,10 +88,11 @@ target(log)
   addValueWithDerivatives(); setNotPeriodic();
 }
 
-void FunctionTarget::calculate(){
+void Target::calculate(){
   double r=target.calculate( derivs );
   setValue(r);
   for(unsigned i=0;i<derivs.size();i++) setDerivative(i,derivs[i]);
 }
 
 }
+}