diff --git a/AutoCorrEstimator.cc b/AutoCorrEstimator.cc
index 6e6dab737f5c86faac71487261439f9c98783659..68cf93f773c047682fdfa7842ea75a63423be0e9 100644
--- a/AutoCorrEstimator.cc
+++ b/AutoCorrEstimator.cc
@@ -32,6 +32,8 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
     USA */
 
+#include <iostream>
+#include <strstream>
 #define WANT_STREAM
 
 #include "AutoCorrEstimator.h"
diff --git a/AutoCorrEstimator.h b/AutoCorrEstimator.h
index 2e5cb13a7d63f445a0a98c3a5f3b55c575e3cd0c..9e9887a13d93f7891bd6b1464f4af27f15e6eca4 100644
--- a/AutoCorrEstimator.h
+++ b/AutoCorrEstimator.h
@@ -9,6 +9,8 @@
 #if !defined(__AutoCorrEstimator_h)
 #define __AutoCorrEstimator_h
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
diff --git a/BandPassOptions.cc b/BandPassOptions.cc
index ed13a9bd566b1f0dcf769dee6b2a2c10738be409..1d773f608be06bd22e34d1adf04a1f518b5f5432 100644
--- a/BandPassOptions.cc
+++ b/BandPassOptions.cc
@@ -9,6 +9,10 @@
 #define WANT_STREAM
 #define WANT_MATH
 
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
 #include "BandPassOptions.h"
diff --git a/BandPassOptions.h b/BandPassOptions.h
index 7f4d3eba662cb2d2c8569aa960db03f45c5962be..88fd9f45c99568b644f203cc4f0c17f44f44addc 100644
--- a/BandPassOptions.h
+++ b/BandPassOptions.h
@@ -9,6 +9,12 @@
 #if !defined(__BandPassOptions_h)
 #define __BandPassOptions_h
 
+#include <string>
+#include <math.h>
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 
 namespace FILM {
 
diff --git a/ContrastMgr.cc b/ContrastMgr.cc
index 983469488032ea8f1db7907f3eca7feb9be804c0..cc9b21f9ec0407a364c3826197c9d34663cb0171 100644
--- a/ContrastMgr.cc
+++ b/ContrastMgr.cc
@@ -6,6 +6,8 @@
 
 /*  CCOPYRIGHT  */
 
+#include <strstream>
+#include <fstream>
 #include "ContrastMgr.h"
 #include "ContrastMgrOptions.h"
 #include "miscmaths/miscmaths.h"
diff --git a/ContrastMgr.h b/ContrastMgr.h
index 1dc337589c74074b12e81a4dbdea8ce4ed1275a4..ce4b81d05f3f98e5a0259468110ff63141b4cf10 100644
--- a/ContrastMgr.h
+++ b/ContrastMgr.h
@@ -9,6 +9,8 @@
 #if !defined(__ContrastMgr_h)
 #define __ContrastMgr_h
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
diff --git a/ContrastMgrOptions.cc b/ContrastMgrOptions.cc
index 9ee34de321bb5fe69d87d094ca86d2dcb0f24ba8..42c4119ea6a0d9210bb1e7e17620be8d6c1fe155 100644
--- a/ContrastMgrOptions.cc
+++ b/ContrastMgrOptions.cc
@@ -9,6 +9,10 @@
 #define WANT_STREAM
 #define WANT_MATH
 
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
 #include "ContrastMgrOptions.h"
diff --git a/ContrastMgrOptions.h b/ContrastMgrOptions.h
index 5cdc83e7c9374df00eb4f5363dd8865ba5b92300..00607950af0285edca13a5c63541696dcf16a16c 100644
--- a/ContrastMgrOptions.h
+++ b/ContrastMgrOptions.h
@@ -9,6 +9,12 @@
 #if !defined(__ContrastMgrOptions_h)
 #define __ContrastMgrOptions_h
 
+#include <string>
+#include <math.h>
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include "utils/log.h"
 
 using namespace Utilities;
diff --git a/FilmGlsOptions.cc b/FilmGlsOptions.cc
index 49b7a8147ea21bd803847fa760c743778c8a9d53..fedbecbc5fc3cef2ad51e21443f0c8444c9b0a46 100644
--- a/FilmGlsOptions.cc
+++ b/FilmGlsOptions.cc
@@ -9,6 +9,10 @@
 #define WANT_STREAM
 #define WANT_MATH
 
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include "FilmGlsOptions.h"
 #include "utils/log.h"
 
diff --git a/FilmGlsOptions.h b/FilmGlsOptions.h
index ded6249190e08410daf4eccb9154a502773824d9..165fef71dc3c9bf9ac308641f9f348816d116d8f 100644
--- a/FilmGlsOptions.h
+++ b/FilmGlsOptions.h
@@ -9,6 +9,12 @@
 #if !defined(__FilmGlsOptions_h)
 #define __FilmGlsOptions_h
 
+#include <string>
+#include <math.h>
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include "utils/log.h"
 
 using namespace Utilities;
diff --git a/FilmGlsOptionsRes.cc b/FilmGlsOptionsRes.cc
index 819736efad4432034c04fd980fe2346567c48e0f..23fc9d55e950d955e2a34d8b041f612a2b295503 100644
--- a/FilmGlsOptionsRes.cc
+++ b/FilmGlsOptionsRes.cc
@@ -9,6 +9,10 @@
 #define WANT_STREAM
 #define WANT_MATH
 
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
 #include "FilmGlsOptionsRes.h"
diff --git a/FilmGlsOptionsRes.h b/FilmGlsOptionsRes.h
index 75a93f466e93c414e01352a2154b4ebd1842c7a9..bb0f4a6446d1f5e1976f3f020c4089e82ff8fd01 100644
--- a/FilmGlsOptionsRes.h
+++ b/FilmGlsOptionsRes.h
@@ -9,6 +9,12 @@
 #if !defined(__FilmGlsOptionsRes_h)
 #define __FilmGlsOptionsRes_h
 
+#include <string>
+#include <math.h>
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 
 namespace FILM {
 
diff --git a/FilmOlsOptions.cc b/FilmOlsOptions.cc
index 25b872e8f34dd2ba8f80f4f2699df57e26edbd01..6685e5c0cd6a826faf168e37093870d982e093ef 100644
--- a/FilmOlsOptions.cc
+++ b/FilmOlsOptions.cc
@@ -10,6 +10,10 @@
 #define WANT_STREAM
 #define WANT_MATH
 
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
 #include "FilmOlsOptions.h"
diff --git a/FilmOlsOptions.h b/FilmOlsOptions.h
index 2b9c29048d15aeb02c4905cac32b6b703d8c8520..78ccfebc29463c176a069520f72b27867b5e77b5 100644
--- a/FilmOlsOptions.h
+++ b/FilmOlsOptions.h
@@ -9,6 +9,12 @@
 #if !defined(__FilmOlsOptions_h)
 #define __FilmOlsOptions_h
 
+#include <string>
+#include <math.h>
+#include <iostream.h>
+#include <fstream.h>
+#include <stdlib.h>
+#include <stdio.h>
 
 namespace FILM {
 
diff --git a/Log.h b/Log.h
index 9d81f20219539d582288353d3f79142c4a7b780c..a3a925f34a7366b735a333d7cdebed359664538b 100644
--- a/Log.h
+++ b/Log.h
@@ -6,6 +6,11 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+#include <math.h>
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
 
diff --git a/Logbak.h b/Logbak.h
index 9d81f20219539d582288353d3f79142c4a7b780c..a3a925f34a7366b735a333d7cdebed359664538b 100644
--- a/Logbak.h
+++ b/Logbak.h
@@ -6,6 +6,11 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+#include <math.h>
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
 
diff --git a/Volume.cc b/Volume.cc
index 96b0043f06a4ae0f88e06e86cf5f9b8c91a9c85c..e0dce3e99aaac6926bd51e82349677a6241dde9d 100644
--- a/Volume.cc
+++ b/Volume.cc
@@ -6,6 +6,9 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <cstdlib>
+#include <avwio.h>
 
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
diff --git a/Volume.h b/Volume.h
index da85e3f2c80cab80c90e4ee94829569868b58554..7d89e6d6f2f57fd85252c97c87b96f6c9981ff55 100644
--- a/Volume.h
+++ b/Volume.h
@@ -9,12 +9,15 @@
 #if !defined(__Volume_h)
 #define __Volume_h
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
 #include "VolumeSeries.h"
+#include <string>
 
 using namespace NEWMAT;
 namespace FILM {
diff --git a/VolumeSeries.cc b/VolumeSeries.cc
index 52459ca18fdbcfb9db5433b5d2ddaeb9731bfdb2..96de6d632c0ae1167622de52a4792c6a371d43f8 100644
--- a/VolumeSeries.cc
+++ b/VolumeSeries.cc
@@ -6,6 +6,9 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <cstdlib>
+#include <avwio.h>
 
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
diff --git a/VolumeSeries.h b/VolumeSeries.h
index 5dd5939010d080534e2489e1baf7ed47209a78a0..52afe92aabe4c0d95b83533982371d54cd8a1d6e 100644
--- a/VolumeSeries.h
+++ b/VolumeSeries.h
@@ -6,12 +6,15 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
 #include "newmat/newmatap.h"
 #include "newmat/newmatio.h"
 
+#include <string>
 
 using namespace NEWMAT;
 
diff --git a/band_pass.cc b/band_pass.cc
index 6c0df8c7799afb77f809a6b91b06045980656081..261225c7b5e8236dc22d6cbb732555088b4471f2 100644
--- a/band_pass.cc
+++ b/band_pass.cc
@@ -6,6 +6,9 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
+#include <strstream>
 #define WANT_STREAM
 #define WANT_MATH
 
@@ -15,6 +18,7 @@
 #include "Volume.h"
 #include "utils/log.h"
 #include "BandPassOptions.h"
+#include <string>
 
 #ifndef NO_NAMESPACE
 using namespace NEWMAT;
diff --git a/contrast_mgr.cc b/contrast_mgr.cc
index 000ae4b0a99f8606d869fdc04dcbfa12bb534f95..5871ab32b934373bb53a079b7e80f609493bf865 100644
--- a/contrast_mgr.cc
+++ b/contrast_mgr.cc
@@ -6,6 +6,9 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
+#include <strstream>
 #define WANT_STREAM
 #define WANT_MATH
 
@@ -18,6 +21,7 @@
 #include "utils/log.h"
 #include "ContrastMgrOptions.h"
 #include "utils/tracer_plus.h"
+#include <string>
 
 using namespace NEWMAT;
 using namespace FILM;
diff --git a/film_gls.cc b/film_gls.cc
index ce6967d9f357cf09e587a1a8e803ca029085cb89..9778e1ec910a737c066f4a5efd4c0b18375361b2 100644
--- a/film_gls.cc
+++ b/film_gls.cc
@@ -6,6 +6,9 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
+#include <strstream>
 #define WANT_STREAM
 #define WANT_MATH
 
@@ -19,6 +22,8 @@
 #include "paradigm.h"
 #include "FilmGlsOptions.h"
 #include "glimGls.h"
+#include <vector>
+#include <string>
 
 using namespace NEWMAT;
 using namespace FILM;
diff --git a/film_gls_res.cc b/film_gls_res.cc
index 55eb1e7dbe251d498cd43636e84bc328123e53dc..92e18963e9937c38c674260352cb7ce60149bc93 100644
--- a/film_gls_res.cc
+++ b/film_gls_res.cc
@@ -6,6 +6,9 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
+#include <strstream>
 #define WANT_STREAM
 #define WANT_MATH
 
@@ -20,6 +23,8 @@
 #include "paradigm.h"
 #include "FilmGlsOptionsRes.h"
 #include "glimGls.h"
+#include <vector>
+#include <string>
 
 using namespace NEWMAT;
 using namespace FILM;
diff --git a/film_ols.cc b/film_ols.cc
index 5d0a68b1101775d1b71d59113cc529b1715210fb..efb019fa72ba44b295bee45931db851821a98a64 100644
--- a/film_ols.cc
+++ b/film_ols.cc
@@ -6,6 +6,9 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
+#include <strstream>
 #define WANT_STREAM
 #define WANT_MATH
 
@@ -20,6 +23,7 @@
 #include "AutoCorrEstimator.h"
 #include "paradigm.h"
 #include "FilmOlsOptions.h"
+#include <string>
 
 using namespace NEWMAT;
 using namespace FILM;
diff --git a/ftoz.cc b/ftoz.cc
index f38c1c8f86ac2be32fcc27fb1db7a180eda7dfcd..b3c9c69b6e2d9eac4494b309f7ac262a7b3d5099 100644
--- a/ftoz.cc
+++ b/ftoz.cc
@@ -6,6 +6,8 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
@@ -14,6 +16,7 @@
 
 #include "miscmaths/f2z.h"
 #include "Volume.h"
+#include <string>
 
 using namespace NEWMAT;
 using namespace FILM;
diff --git a/gaussComparer.h b/gaussComparer.h
index 263e47c9a9b1ceb278063302d39d38f736ca502c..93e5c809be23c1f673bb2f3bf99b9327e0bd68cb 100644
--- a/gaussComparer.h
+++ b/gaussComparer.h
@@ -9,6 +9,8 @@
 #if !defined(__gaussComparer_h)
 #define __gaussComparer_h
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
diff --git a/glim.cc b/glim.cc
index a326e7647a642acc1eb452ef97fd8357be1facd3..c8bbaee28346afa5f1da908c76a85eec3ac5e56e 100644
--- a/glim.cc
+++ b/glim.cc
@@ -6,6 +6,7 @@
 
 /*  CCOPYRIGHT  */
 
+#include <strstream>
 
 #include "glim.h"
 #include "miscmaths/miscmaths.h"
diff --git a/glim.h b/glim.h
index fb07f5f0ec1da00ecf6fdf19ea00a22c413764de..4cedf56db5106b2f7eab274ec94267cf0206b7f7 100644
--- a/glim.h
+++ b/glim.h
@@ -6,6 +6,8 @@
 
 /*  CCOPYRIGHT  */
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
diff --git a/glimGls.cc b/glimGls.cc
index cea30d1697348db4a396d194596baf4fcf35749a..07b0c75f2097e8693cd2ee4348edeec84b5baaab 100644
--- a/glimGls.cc
+++ b/glimGls.cc
@@ -6,6 +6,7 @@
 
 /*  CCOPYRIGHT  */
 
+#include <strstream>
 
 #include "glimGls.h"
 #include "miscmaths/miscmaths.h"
diff --git a/glimGls.h b/glimGls.h
index adabc4b585bfc3af5051e320324adc3bb54fb262..8a8f3baed1dd13b65f11623168d801f83b6f8951 100644
--- a/glimGls.h
+++ b/glimGls.h
@@ -9,6 +9,8 @@
 #if !defined(__glimgls_h)
 #define __glimgls_h
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
diff --git a/glm.h b/glm.h
index 5ebb5fc7ea11d37d8c84085e900c23ddc716a979..8618036676e94155fd89b269e0f38af4650feaa9 100644
--- a/glm.h
+++ b/glm.h
@@ -9,6 +9,8 @@
 #if !defined(__glm_h)
 #define __glm_h
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
diff --git a/glmrand.cc b/glmrand.cc
index bcfc147fb726450ec588a2cb878666035255e3b0..96e535b058ec8d30ae7c02b188ccf27cd50abe08 100644
--- a/glmrand.cc
+++ b/glmrand.cc
@@ -13,6 +13,8 @@
 #include "miscmaths/t2z.h"
 #define __STL_NO_DRAND48
 
+#include <vector.h>
+#include <algo.h>
 
 #ifndef NO_NAMESPACE
 using namespace MISCMATHS;
diff --git a/glmrand.h b/glmrand.h
index 0286f370d85e71b5cc3ad888114ce52fb30922e9..30fac52528f52bf07ce084148fa3cb4a88a2ae3a 100644
--- a/glmrand.h
+++ b/glmrand.h
@@ -9,6 +9,8 @@
 #if !defined(__glmRand_h)
 #define __glmRand_h
 
+#include <iostream>
+#include <fstream>
 #define WANT_STREAM
 #define WANT_MATH
 
diff --git a/paradigm.cc b/paradigm.cc
index 2ef814ac07a39dc8758f73d22cf383e079fdd696..427ce6eafc3187e2d877252fd47d4d5d3181cb93 100644
--- a/paradigm.cc
+++ b/paradigm.cc
@@ -7,8 +7,8 @@
 /*  CCOPYRIGHT  */
 
 #include "paradigm.h"
-#include "log.h"
-#include "miscmaths.h"
+#include "utils/log.h"
+#include "miscmaths/miscmaths.h"
 #include <fstream>
 
 using namespace FILM;
diff --git a/paradigm.h b/paradigm.h
index 837dbfe2d7aa14e6efa6b7bc9d965b544b9d5787..f8137892e4fed3389c20420b9d65033ee66d44f6 100644
--- a/paradigm.h
+++ b/paradigm.h
@@ -11,8 +11,8 @@
 
 #include <iostream>
 #include <fstream>
-#include "newmatap.h"
-#include "newmatio.h"
+#include "newmat/newmatap.h"
+#include "newmat/newmatio.h"
 #include <string>
 
 using namespace NEWMAT;
diff --git a/quick.cc b/quick.cc
index 6ceb93a98c730fc12d5f544b640870e2776dc81e..0c52e30031751a683533ffcc4ee739d43bdaab42 100644
--- a/quick.cc
+++ b/quick.cc
@@ -5,18 +5,18 @@
 #define WANT_STREAM
 #define WANT_MATH
 
-#include "newmatap.h"
-#include "newmatio.h"
+#include "newmat/newmatap.h"
+#include "newmat/newmatio.h"
 #include <string>
 #include <math.h>
 #include "glmrand.h"
 #include "Volume.h"
-#include "log.h"
+#include "utils/log.h"
 #include "histogram.h"
-#include "t2z.h"
-#include "f2z.h"
-#include "miscmaths.h"
-#include "libprob.h"
+#include "miscmaths/t2z.h"
+#include "miscmaths/f2z.h"
+#include "miscmaths/miscmaths.h"
+#include "libprob/libprob.h"
 #include <time.h>
 
 using namespace Utilities;
diff --git a/ttologp.cc b/ttologp.cc
index ea80c669d4d0f81687e2ae767781afda738ebf03..abe342109ce1f250eca2a097c9931ccc39a0243f 100644
--- a/ttologp.cc
+++ b/ttologp.cc
@@ -11,13 +11,13 @@
 #define WANT_STREAM
 #define WANT_MATH
 
-#include "newmatap.h"
-#include "newmatio.h"
+#include "newmat/newmatap.h"
+#include "newmat/newmatio.h"
 
-#include "t2z.h"
+#include "miscmaths/t2z.h"
 #include "Volume.h"
 #include <string>
-#include "miscmaths.h"
+#include "miscmaths/miscmaths.h"
 
 using namespace NEWMAT;
 using namespace FILM;
diff --git a/ttoz.cc b/ttoz.cc
index 433e61e80a8280d5e6c35b949969d4febdea8875..cdf48698b481365dbe0becd4ed4842a6ace67586 100644
--- a/ttoz.cc
+++ b/ttoz.cc
@@ -11,11 +11,11 @@
 #define WANT_STREAM
 #define WANT_MATH
 
-#include "newmatap.h"
-#include "newmatio.h"
-#include "miscmaths.h"
+#include "newmat/newmatap.h"
+#include "newmat/newmatio.h"
+#include "miscmaths/miscmaths.h"
 
-#include "t2z.h"
+#include "miscmaths/t2z.h"
 #include "Volume.h"
 #include <string>