Index: trunk/FACT++/src/Fits.cc
===================================================================
--- trunk/FACT++/src/Fits.cc	(revision 11014)
+++ trunk/FACT++/src/Fits.cc	(revision 11015)
@@ -35,8 +35,8 @@
 //! @param numDataBytes the number of bytes taken by the variable
 //
-void Fits::AddStandardColumn(Description& desc, string dataFormat, void* dataPointer, long unsigned int numDataBytes)
+void Fits::AddStandardColumn(const Description& desc, const string &dataFormat, void* dataPointer, long unsigned int numDataBytes)
 {
 	//check if entry already exist
-	for (vector<Description>::iterator it=fStandardColDesc.begin(); it != fStandardColDesc.end(); it++)
+	for (vector<Description>::const_iterator it=fStandardColDesc.begin(); it != fStandardColDesc.end(); it++)
 		if (it->name == desc.name)
 			return;
@@ -54,5 +54,5 @@
 //! @param numDataBytes the number of bytes taken by the DIM data. 
 //	
-void Fits::InitDataColumns(vector<Description> desc, vector<string>& dataFormat, void* dataPointer, int numDataBytes)
+void Fits::InitDataColumns(const vector<Description> &desc, vector<string>& dataFormat, void* dataPointer, int numDataBytes)
 {//we will copy this information here. It duplicates the data, which is not great, but it is the easiest way of doing it right now
 	if (desc.size() == dataFormat.size())
@@ -101,5 +101,5 @@
 		{			
 			ostringstream str;
-			str << "Could not open FITS file " << fileName << " reason: " << e.message();
+			str << "Opening FITS file " << fileName << ": " << e.message();
 			fMess->Error(str);
 			fFile = NULL;
@@ -129,5 +129,5 @@
 	}
 	//for (int i=static_cast<int>(fDataColDesc.size())-1;i>=0;i--)
-	for (int i=0; i< static_cast<int>(fDataColDesc.size()); i++)
+	for (unsigned int i=0; i<fDataColDesc.size(); i++)
 	{
 		if (fDataColDesc[i].name != "")
@@ -147,23 +147,23 @@
 	try
 	{
-		string factTableName = tableName;
 		//first, let's check if the table already exist in the file
 		vector<string> tryToLoadName;
-		tryToLoadName.push_back(factTableName);
-		fFile->read(tryToLoadName);
+		tryToLoadName.push_back(tableName);
+                fFile->read(tryToLoadName);
+
 	    const multimap< string, CCfits::ExtHDU * >& extMap = fFile->extension();
-	    if (extMap.find(factTableName) == extMap.end())
+	    if (extMap.find(tableName) == extMap.end())
 	    {
 	        for (multimap<string, CCfits::ExtHDU*>::const_iterator it=extMap.begin(); it!= extMap.end(); it++)
 	            fMess->Debug(it->first);
-	        fTable = fFile->addTable(factTableName, 0, allNames, allDataTypes, allUnits);
+	        fTable = fFile->addTable(tableName, 0, allNames, allDataTypes, allUnits);
 	    }
 	    else
 	    {
-	        fTable = dynamic_cast<CCfits::Table*>(extMap.find(factTableName)->second);
+	        fTable = dynamic_cast<CCfits::Table*>(extMap.find(tableName)->second);
 	    }
 	    if (!fTable)
 	    {
-	        fMess->Error("The table " + factTableName + " could not be created nor loaded. skipping it");
+	        fMess->Error("Table " + tableName + " could not be created nor loaded from "+fileName);
 	        Close();
 	        return false;
@@ -177,5 +177,5 @@
 			if (!bTable)
 			{
-				fMess->Error("The table " + factTableName + " could not be converted to a binary table. skipping");
+				fMess->Error("Table " + tableName + " in "+fileName+" could not be converted to a binary table.");
 				Close();
 				return false;
@@ -186,12 +186,11 @@
 
 			//double check that the data was indeed read from the disk. Go through the fTable instead as colName is empty (yes, it is !)
-			map<string, Column*> cMap = fTable->column();
-			map<string, Column*>::iterator cMapIt;
-
-			for (cMapIt = cMap.begin(); cMapIt != cMap.end(); cMapIt++)
+			const map<string, Column*> cMap = fTable->column();
+
+                        for (map<string, Column*>::const_iterator cMapIt = cMap.begin(); cMapIt != cMap.end(); cMapIt++)
 			{
 				if (!cMapIt->second->isRead())
 				{
-					fMess->Error("Column " + cMapIt->first + "Could not be read back from the disk");
+					fMess->Error("Reading column " + cMapIt->first + " back from "+fileName+" failed.");
 					Close();
 					return false;
@@ -205,5 +204,5 @@
 	{
 		ostringstream str;
-		str << "Could not open or create FITS table " << tableName << " in  file " << fileName << " reason: " << e.message();
+                str << "Opening or creating table " << tableName << " in " << fileName << ": " << e.message();
 		fMess->Error(str);
 		fTable = NULL;
@@ -226,5 +225,5 @@
 //!@param a comment explaining the meaning of the key
 template <typename T>
-bool Fits::WriteSingleHeaderKey(string name, T value, string comment)
+bool Fits::WriteSingleHeaderKey(const string &name, const T &value, const string &comment)
 {
 	try
@@ -249,8 +248,7 @@
 	if (!fTable)
 		return false;
-	string name;
-	string comment;
-
-	string stringValue;
+
+        string stringValue = Time().GetAsStr();
+	stringValue[10]= 'T';
 
 	if (!WriteSingleHeaderKey("EXTREL", 1.0f, "Release Number")) return false;
@@ -258,6 +256,4 @@
 	if (!WriteSingleHeaderKey("ORIGIN", "ISDC", "Institution that wrote the file")) return false;
 	if (!WriteSingleHeaderKey("CREATOR", "FACT++ DataLogger", "Program that wrote this file")) return false;
-	stringValue = Time().GetAsStr();
-	stringValue[10]= 'T';
 	if (!WriteSingleHeaderKey("DATE", stringValue, "File creation data")) return false;
 	if (!WriteSingleHeaderKey("TIMESYS", "TT", "Time frame system")) return false;
@@ -373,5 +369,5 @@
 	if (stat(fFileName.c_str(), &st))
 		return 0;
-	else
-		return st.st_size;
-}
+
+        return st.st_size;
+}
Index: trunk/FACT++/src/Fits.h
===================================================================
--- trunk/FACT++/src/Fits.h	(revision 11014)
+++ trunk/FACT++/src/Fits.h	(revision 11015)
@@ -88,8 +88,8 @@
 		
 		///Adds a column that exists in all FITS files
-		void AddStandardColumn(Description& desc, string dataFormat, void* dataPointer, long unsigned int numDataBytes);
+		void AddStandardColumn(const Description& desc, const string &dataFormat, void* dataPointer, long unsigned int numDataBytes);
 		
 		///Adds columns specific to the service being logged.
-		void InitDataColumns(vector<Description> desc, vector<string>& dataFormat, void* dataPointer, int numDataBytes);
+		void InitDataColumns(const vector<Description> &desc, vector<string>& dataFormat, void* dataPointer, int numDataBytes);
 
 		///Opens a FITS file
@@ -106,5 +106,5 @@
 private:
 		template <typename T>
-		bool WriteSingleHeaderKey(string name, T value, string comment);
+		bool WriteSingleHeaderKey(const string &name, const T &value, const string &comment);
 
 };//Fits
