diff --git a/src/Action.h b/src/Action.h
index c9a34244c6dc083d72f9d4b47d60c8131ad2de94..61c111bbe8752e1a8777465f95aada246ff3ad19 100644
--- a/src/Action.h
+++ b/src/Action.h
@@ -3,14 +3,13 @@
 #include <vector>
 #include <string>
 #include <set>
-#include "Log.h"
 #include "Tools.h"
-
-#include "PlumedCommunicator.h"
+#include "Log.h"
 
 namespace PLMD{
 
 class PlumedMain;
+class PlumedCommunicator;
 
 /// This class is used to bring the relevant information to the Action constructor.
 /// Only Action and ActionRegister class can access to its content, which is 
diff --git a/src/ActionWithArguments.h b/src/ActionWithArguments.h
index 45546f5b40701167b790c9db791202f62c35b326..222b46144a52f092e9b65d8daa73c2b72aa0354f 100644
--- a/src/ActionWithArguments.h
+++ b/src/ActionWithArguments.h
@@ -1,12 +1,11 @@
 #ifndef __PLUMED_ActionWithArguments_h
 #define __PLUMED_ActionWithArguments_h
 
-#include "Action.h"
 #include <map>
 #include <vector>
 #include <cassert>
-
-#include "ActionWithValue.h"
+#include "Action.h"
+#include "Value.h"
 
 namespace PLMD{
 
diff --git a/src/ActionWithValue.h b/src/ActionWithValue.h
index 45e6742d5e81c516ca79a4f021c8d7cf4f599ca5..2f5737e57afb1dfc062e6d825e52676f2f649ed6 100644
--- a/src/ActionWithValue.h
+++ b/src/ActionWithValue.h
@@ -1,10 +1,10 @@
 #ifndef __PLUMED_ActionWithValue_h
 #define __PLUMED_ActionWithValue_h
 
-#include "Action.h"
 #include <map>
 #include <vector>
 #include <cassert>
+#include "Action.h"
 #include "Value.h"
 
 namespace PLMD{
diff --git a/src/DumpDerivatives.cpp b/src/DumpDerivatives.cpp
index 9068278bcfccd0d52858e474490f66527c7bd52e..03714939c2314062ce32b216c2d75afe4b40aaa8 100644
--- a/src/DumpDerivatives.cpp
+++ b/src/DumpDerivatives.cpp
@@ -1,6 +1,7 @@
 #include "ActionPilot.h"
 #include "ActionWithArguments.h"
 #include "ActionRegister.h"
+#include "PlumedCommunicator.h"
 
 using namespace std;
 
diff --git a/src/Log.cpp b/src/Log.cpp
index 9525262853928de6702ed1d547c2df78511d3df2..c4d8ec13210e66b9c08a3710ac51d81426577b3b 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -1,4 +1,5 @@
 #include "Log.h"
+#include "PlumedCommunicator.h"
 #include <cstdarg>
 #include <cassert>
 #include <cstring>
diff --git a/src/Log.h b/src/Log.h
index 2a27ccb13484ab6496b5b2887cb1a8e8727acaa5..becbfb5b396fa3761be948fd4d1118457db0030c 100644
--- a/src/Log.h
+++ b/src/Log.h
@@ -3,10 +3,11 @@
 #include <cstdio>
 #include <string>
 #include <sstream>
-#include "PlumedCommunicator.h"
 
 namespace PLMD{
 
+class PlumedCommunicator;
+
 /// Class containing the log stream.
 ///
 /// It is similar to a FILE stream. It allows a printf() function, and
diff --git a/src/Print.cpp b/src/Print.cpp
index ca722789c6ce416b47a007141b455c42c2c984f1..a0ad96632295bb857ec446ca659cbe6f56886d65 100644
--- a/src/Print.cpp
+++ b/src/Print.cpp
@@ -1,6 +1,7 @@
 #include "ActionPilot.h"
 #include "ActionWithArguments.h"
 #include "ActionRegister.h"
+#include "PlumedCommunicator.h"
 
 using namespace std;
 
diff --git a/src/Tools.cpp b/src/Tools.cpp
index 361488fb6b89e2ab5de0d93d0ed0377d935840b9..d36815f3f84b2c83fa13cc1f825c23578a31abb0 100644
--- a/src/Tools.cpp
+++ b/src/Tools.cpp
@@ -1,6 +1,6 @@
 #include "Tools.h"
 #include <cstring>
-#include <assert.h>
+#include <cassert>
 #include <sstream>
 
 using namespace PLMD;