diff --git a/GeoModelDBManager/GeoModelDBManager/GMDBManager.h b/GeoModelDBManager/GeoModelDBManager/GMDBManager.h
index cd4090a6177ea2a8abd826e755998b8161e9c2f7..79e62f5bbc48ae6ffec39d9ed9335e1d37d10f2c 100644
--- a/GeoModelDBManager/GeoModelDBManager/GMDBManager.h
+++ b/GeoModelDBManager/GeoModelDBManager/GMDBManager.h
@@ -37,7 +37,7 @@ public:
 	 * Constructor sets up connection with db and opens it
 	 * @param path - absolute path to db file
 	 */
-	GMDBManager(const QString& path);
+  GMDBManager(const std::string &path);
 
 	/**
 	 * @brief Destructor
@@ -142,7 +142,7 @@ public:
 	QVariant addFullPhysVol(const QVariant &logVolId, const QVariant &parentPhysVolId, bool isRootVolume = false);
 	QVariant addSerialDenominator(const QString &baseName);
 	QVariant addFunction(const QString expression);
-	QVariant addSerialTransformer(const QVariant &funcId, const QVariant &physvolId, const QString volType, const unsigned int &copies);
+  QVariant addSerialTransformer(const unsigned int &funcId, const unsigned int &physvolId, const std::string &volType, const unsigned int &copies);
 	QVariant addTransform(QVector<double> parameters);
 	QVariant addAlignableTransform(QVector<double> parameters);
 	QVariant addNameTag(const QString &name);
@@ -154,34 +154,31 @@ public:
 	bool addListOfRecordsToTable(const QString tableName, const std::vector<QStringList> records);
   bool addListOfRecordsToTable(const std::string tableName, const std::vector<std::vector<std::string>> records);
   
-	bool addListOfRecordsToTableOld(const QString tableName, const std::vector<QStringList> records);
-	bool addListOfChildrenPositions(const std::vector<QStringList> records);
+//  bool addListOfRecordsToTableOld(const QString tableName, const std::vector<QStringList> records); // for the old SQlite only
+  bool addListOfChildrenPositions(const std::vector<std::vector<std::string>> &records);
 
-	bool addRootVolume(const QStringList);
-	void addChildPosition(const QVariant parentId, const QString parentType, const QVariant childId, const unsigned int parentCopyNumber, const unsigned int childPos, const QString childType, const unsigned int childCopyN);
+	bool addRootVolume(const std::vector<std::string> &values);
+  void addChildPosition(const unsigned int &parentId, const std::string &parentType, const unsigned int &childId, const unsigned int &parentCopyNumber, const unsigned int &childPos, const std::string &childType, const unsigned int &childCopyN);
 
 	void addDBversion(const QString);
 
 	// GET methods
 
-	QString getDBFilePath();
+  std::string getDBFilePath();
 
-	QStringList getRootPhysVol();
-  std::vector<std::string> getRootPhysVolStd();
+  std::vector<std::string> getRootPhysVol();
 
-	QStringList getItem(QString geoType, unsigned int id);
-	QStringList getItem(unsigned int tableId, unsigned int id);
+  std::vector<std::string> getItem(std::string geoType, unsigned int id);
+  std::vector<std::string> getItem(unsigned int tableId, unsigned int id);
+  
 	
-  QStringList getItemFromTableName(QString tableName, unsigned int id);
-  std::vector<std::string> getItemFromTableNameStd(QString tableName, unsigned int id);
+  std::vector<std::string> getItemFromTableName(std::string tableName, unsigned int id);
   
-	QStringList getItemAndType(unsigned int tableId, unsigned int id);
-  std::vector<std::string> getItemAndTypeStd(unsigned int tableId, unsigned int id);
+  std::vector<std::string> getItemAndType(unsigned int tableId, unsigned int id);
 
-	QString getNodeTypeFromTableId(unsigned int id);
-  std::string getNodeTypeFromTableIdStd(unsigned int id);
+  std::string getNodeTypeFromTableId(unsigned int id);
 
-	QMap<unsigned int, QStringList> getVPhysVolChildren(const unsigned int id, const QString nodeType, const unsigned int copyN);
+  QMap<unsigned int, QStringList> getVPhysVolChildren(const unsigned int &id, const std::string &nodeType, const unsigned int &copyN);
 
 	/// methods to dump the DB
 	QHash<QString, QMap<unsigned int, QStringList>> getChildrenTable();
@@ -190,10 +187,10 @@ public:
 	QHash<unsigned int, QStringList> getTableFromNodeType(QString nodeType);
   std::vector<std::vector<std::string>> getTableFromNodeTypeStd(std::string nodeType);
   
-	QHash<unsigned int, QString> getAll_TableIDsNodeTypes();
-	QHash<QString, unsigned int> getAll_NodeTypesTableIDs();
-  std::unordered_map<unsigned int, std::string> getAll_TableIDsNodeTypesStd();
-  std::unordered_map<std::string, unsigned int> getAll_NodeTypesTableIDsStd();
+//  QHash<unsigned int, QString> getAll_TableIDsNodeTypes();
+//  QHash<QString, unsigned int> getAll_NodeTypesTableIDs();
+  std::unordered_map<unsigned int, std::string> getAll_TableIDsNodeTypes();
+  std::unordered_map<std::string, unsigned int> getAll_NodeTypesTableIDs();
   
 
 
@@ -205,34 +202,38 @@ private:
 	void loadTestData(); // for debug only
 
 	void loadTableNamesFromDB();
-	QStringList getTableColNamesFromDB(QString tableName) const;
+  std::vector<std::string> getTableColNamesFromDB(std::string tableName) const;
 
-	QString getTableNameFromTableId(unsigned int tabId);
-  std::string getTableNameFromTableIdStd(unsigned int tabId);
+//  QString getTableNameFromTableId(unsigned int tabId);
+  std::string getTableNameFromTableId(unsigned int tabId);
   
-	QVariant getTableIdFromNodeType(QString nodeType);
-	void storeNodeType(QString nodeType, QString tableName);
-	QString getTableNameFromNodeType(QString nodeType);
+  unsigned int getTableIdFromNodeType(const std::string &nodeType);
+  void storeNodeType(std::string nodeType, std::string tableName);
+	
+  QString getTableNameFromNodeType(QString nodeType); // TODO: to be removed
+  std::string getTableNameFromNodeType(std::string nodeType);
 
-	QSqlQuery selectAllFromTable(QString tableName) const;
-  QSqlQuery selectAllFromTableSortBy(QString tableName, std::string sortColumn="") const;
+  
+//  QSqlQuery selectAllFromTable(QString tableName) const;
+  QSqlQuery selectAllFromTable(std::string tableName) const;
+  QSqlQuery selectAllFromTableSortBy(std::string tableName, std::string sortColumn="") const;
 
 
 //  void storeTableColumnNames(QStringList input);
   void storeTableColumnNames(std::vector<std::string> input);
   
-	QStringList getTableColumnNames(QString tableName);
-	void printTableColNamesFromDB(QString tableName) const;
+  std::vector<std::string> getTableColumnNames(const std::string &tableName);
+  void printTableColNamesFromDB(const std::string &tableName) const;
 
-	void printAllRecords(QString tableName) const;
+  void printAllRecords(const std::string &tableName) const;
 
-	int getTableColIndex(QString tableName, QString colName);
+  int getTableColIndex(const std::string &tableName, const std::string &colName);
 
-	bool storeRootVolume(QVariant id, QString nodeType);
+  bool storeRootVolume(const unsigned int &id, const std::string &nodeType);
 
 	void showError(const QSqlError &err) const;
 
-  QString m_dbpath;
+  std::string m_dbpath;
 	QSqlDatabase m_db;
 	bool m_dbIsOK;
 
diff --git a/GeoModelDBManager/src/GMDBManager.cpp b/GeoModelDBManager/src/GMDBManager.cpp
index 195cf1c5f4e606d92b3a5bd914515415c814fc09..c86774084f7b6707193110b32a83b7cf8312c8c3 100644
--- a/GeoModelDBManager/src/GMDBManager.cpp
+++ b/GeoModelDBManager/src/GMDBManager.cpp
@@ -16,7 +16,7 @@
 static std::string dbversion = "0.3.0"; // added GeoElement support (Sep 2019)
 
 
-// TODO: move this to utility class/file
+// FIXME: move this to utility class/file
 std::vector<std::string> toStdVectorStrings(QStringList qlist)
 {
   std::vector<std::string> vec;
@@ -26,8 +26,16 @@ std::vector<std::string> toStdVectorStrings(QStringList qlist)
   return vec;
 }
 
+// FIXME: should go to an utility class
+std::string joinVectorStrings(std::vector<std::string> vec, std::string sep="") {
+  std::string s;
+  for (const auto &piece : vec) s += (piece + sep);
+  return s;
+}
+
 
-GMDBManager::GMDBManager(const QString &path) : m_dbpath(path), m_dbIsOK(false),  m_deepDebug(false)
+
+GMDBManager::GMDBManager(const std::string &path) : m_dbpath(path), m_dbIsOK(false),  m_deepDebug(false)
 {
 	// JFB commented: qDebug() << "GMDBManager: constructor";
 
@@ -39,7 +47,7 @@ GMDBManager::GMDBManager(const QString &path) : m_dbpath(path), m_dbIsOK(false),
 	m_dbIsOK = true;
 
 	m_db = QSqlDatabase::addDatabase("QSQLITE");
-	m_db.setDatabaseName(path);
+  m_db.setDatabaseName( QString::fromStdString(path));
 
 	if (!m_db.open())
 	{
@@ -153,17 +161,17 @@ void GMDBManager::printDBVersion() const
 
 
 
-void GMDBManager::printAllRecords(QString tableName) const
+void GMDBManager::printAllRecords(const std::string &tableName) const
 {
-	std::cout << tableName.toStdString() << " in db:" << std::endl;
+	std::cout << tableName << " in db:" << std::endl;
 
 	// QSqlQuery query("SELECT * FROM " + tableName);
-	QSqlQuery query = selectAllFromTable(tableName);
+  QSqlQuery query = selectAllFromTable(tableName);
 
-	int nCols = (m_tableNames[tableName]).size();
+	int nCols = (m_tableNames.at(tableName)).size();
 
 	// print table column names
-	std::cout << "- " << m_tableNames[tableName].join(", ").toStdString() << std::endl;
+	std::cout << "- " <<  joinVectorStrings(m_tableNames.at(tableName), ", ") << std::endl;
 	while (query.next())
 	{
 		std::cout << "* "; // TODO: move to a osstream: it's cleaner
@@ -195,9 +203,9 @@ QHash<unsigned int, QStringList> GMDBManager::getTableFromNodeType(QString nodeT
 	QHash<unsigned int, QStringList> records;
 	QStringList nodeParams;
 
-	int nCols = (m_tableNames[tableName]).size();
+	int nCols = (m_tableNames.at(tableName.toStdString())).size();
 
-	QSqlQuery query = selectAllFromTable(tableName);
+	QSqlQuery query = selectAllFromTable(tableName.toStdString());
 	while (query.next()) {
 		nodeParams.clear();
 		unsigned int nodeId = query.value(0).toUInt();
@@ -213,14 +221,14 @@ return records;
 std::vector<std::vector<std::string>> GMDBManager::getTableFromNodeTypeStd(std::string nodeType)
 {
 
-	QString tableName = getTableNameFromNodeType(QString::fromStdString(nodeType));
+  std::string tableName = getTableNameFromNodeType(nodeType);
 
 	// QHash<unsigned int, QStringList> records;
 	// QStringList nodeParams;
   std::vector<std::vector<std::string>> records;
   std::vector<std::string> nodeParams;
 
-	int nCols = (m_tableNames[tableName]).size();
+	int nCols = (m_tableNames.at(tableName)).size();
 
 	QSqlQuery query = selectAllFromTable(tableName); // sorted by ID
 	while (query.next()) {
@@ -260,7 +268,7 @@ QVariant GMDBManager::addPhysVol(const QVariant &logVolId, const QVariant &paren
 	QVariant lastInserted = q.lastInsertId();
 
 	if (isRootVolume) {
-		storeRootVolume(lastInserted, "GeoPhysVol");
+		storeRootVolume(lastInserted.toUInt(), "GeoPhysVol");
 	}
 
 	return lastInserted;
@@ -284,7 +292,7 @@ QVariant GMDBManager::addFullPhysVol(const QVariant &logVolId, const QVariant &p
 	QVariant lastInserted = q.lastInsertId();
 
 	if (isRootVolume) {
-		storeRootVolume(lastInserted, "GeoFullPhysVol");
+		storeRootVolume(lastInserted.toUInt(), "GeoFullPhysVol");
 	}
 
 	return lastInserted;
@@ -344,7 +352,7 @@ QVariant GMDBManager::addElement(const QString &name, const QString &symbol, con
 	return q.lastInsertId();
 }
 
-bool GMDBManager::addListOfChildrenPositions(const std::vector<QStringList> records)
+bool GMDBManager::addListOfChildrenPositions(const std::vector<std::vector<std::string>> &records)
 {
     // NOTE: Choose the right function for your version of SQLite!!
 	return addListOfRecordsToTable("ChildrenPositions", records); // newest SQLite versions
@@ -355,7 +363,7 @@ bool GMDBManager::addListOfRecords(const QString geoType, const std::vector<QStr
 {
 	if (m_deepDebug) qDebug() << "GMDBManager::addListOfRecords():" << geoType;
 
-    QString tableName = m_childType_tableName[geoType];
+  QString tableName = QString::fromStdString(m_childType_tableName[geoType.toStdString()]);
 
 	if (tableName.isEmpty()) {
         //qWarning() << "m_childType_tableName:" << m_childType_tableName;
@@ -409,7 +417,7 @@ bool GMDBManager::addListOfRecords(const std::string geoType, const std::vector<
 bool GMDBManager::addListOfRecordsToTable(const QString tableName, const std::vector<QStringList> records)
 {
 	// get table columns and format them for query
-	QString tableColString = "(" + m_tableNames[tableName].join(", ") + ")";
+  QString tableColString = "(" + QString::fromStdString(joinVectorStrings(m_tableNames.at(tableName.toStdString()), ", ")) + ")";
 
     unsigned int nRecords = records.size();
     qInfo() << "number of " << tableName << "records to insert into the DB:" << nRecords;
@@ -463,29 +471,30 @@ bool GMDBManager::addListOfRecordsToTable(const QString tableName, const std::ve
 bool GMDBManager::addListOfRecordsToTable(const std::string tableName, const std::vector<std::vector<std::string>> records)
 {
   // get table columns and format them for query
-  QString tableColString = "(" + m_tableNames[tableName].join(", ") + ")";
+  QString tableColString = "(" + QString::fromStdString(joinVectorStrings(m_tableNames.at(tableName), ", ")) + ")";
   
   
   
   
   unsigned int nRecords = records.size();
-  qInfo() << "number of " << tableName << "records to insert into the DB:" << nRecords;
+  std::cout << "number of " << tableName << "records to insert into the DB:" << nRecords;
   
   // preparing the SQL query
   QString queryStr("INSERT INTO %1 %2 VALUES ");
-  queryStr = queryStr.arg(tableName); // insert table name
+  queryStr = queryStr.arg(QString::fromStdString(tableName)); // insert table name
   queryStr = queryStr.arg(tableColString); // insert table columns
   
   unsigned int nMat = nRecords;
   unsigned int id = 0;
-  foreach(QStringList rec, records) {
+//  foreach(QStringList rec, records) {
+  for( const std::vector<std::string>& rec : records) {
     //qDebug() << "rec:" << rec;
     
     ++id;
     QStringList items;
     
-    foreach (QString item, rec) {
-      items << '"' + item + '"';
+    for ( const std::string& item : rec) {
+      items << '"' + QString::fromStdString(item) + '"';
     }
     QString values = items.join(",");
     queryStr += " (" + QString::number(id) + "," + values + ")";
@@ -520,21 +529,23 @@ bool GMDBManager::addListOfRecordsToTable(const std::string tableName, const std
 // we want to build a query like this:
 //  queryStr = QString("INSERT INTO Materials (id, name) SELECT 1 as id, 'Air' as name UNION ALL SELECT 2,'Silicon' UNION ALL SELECT 368,'ShieldSteel' ")
 //
+/*
 bool GMDBManager::addListOfRecordsToTableOld(const QString tableName, const std::vector<QStringList> records)
 {
 	// get table columns and format them for query
-	QString tableColString = "(" + m_tableNames[tableName].join(", ") + ")";
+  std::string tabColNames = joinVectorStrings(m_tableNames.at(tableName.toStdString()), ", ");
+  QString tableColString = "(" + QString::fromStdString(tabColNames) + ")";
 
 
 
-    QStringList colNames = m_tableNames[tableName];
+    QStringList colNames = m_tableNames.at(tableName);
     unsigned int nRecords = records.size();
     qInfo() << "number of " << tableName << "records to insert into the DB:" << nRecords;
 
-    /*
-     * SQLite has a limit on 'union' items, set at 500. So we have to split the items if we have more.
-     * See: stackoverflow.com/questions/9527851/
-     */
+ 
+     // SQLite has a limit on 'union' items, set at 500. So we have to split the items if we have more.
+     // See: stackoverflow.com/questions/9527851/
+ 
     unsigned int bunchSize = 500;
     if ( nRecords > bunchSize ) {
         qWarning() << "WARNING! " << nRecords << " records of type " << tableName << "to store in the DB in one call! Call limit is " << bunchSize << " --> We split them in bunches...";
@@ -689,6 +700,7 @@ bool GMDBManager::addListOfRecordsToTableOld(const QString tableName, const std:
 	return true;
 
 }
+*/
 
 
 
@@ -763,11 +775,11 @@ QVariant GMDBManager::addFunction(const QString expression)
 
 }
 
-QVariant GMDBManager::addSerialTransformer(const QVariant &funcId, const QVariant &physvolId, const QString physvolType, const unsigned int &copies)
+QVariant GMDBManager::addSerialTransformer(const unsigned int &funcId, const unsigned int &physvolId, const std::string &physvolType, const unsigned int &copies)
 {
 	if (m_deepDebug) qDebug() << "GMDBManager::addSerialTransformer()" << funcId << physvolId << copies;
 
-	QVariant volTableId = getTableIdFromNodeType(physvolType);
+	const unsigned int volTableId = getTableIdFromNodeType(physvolType);
 
 	QSqlQuery q;
 	if (!q.prepare(QLatin1String("insert into SerialTransformers(funcId, volId, volTable, copies) values(?, ?, ?, ?)"))) {
@@ -871,34 +883,34 @@ QVariant GMDBManager::addAlignableTransform(QVector<double> params)
 }
 
 
-bool GMDBManager::addRootVolume(const QStringList values)
+bool GMDBManager::addRootVolume(const std::vector<std::string> &values)
 {
 	if (values.size() > 0 ) {
-		QVariant volId = QVariant(values[0]);
-		QString nodeType = values[1];
+    const unsigned int volId = std::stoi(values[0]);
+    const std::string nodeType = values[1];
 		return storeRootVolume( volId, nodeType );
 	}
 	else
-		qFatal("Info: no records to save for RootVolume!");
+  std::cout << "WARNING! No records to save for RootVolume!" << std::endl;
 	return false;
 }
 
 // insert a single parent-child relationship for a given parent volume
-void GMDBManager::addChildPosition(const QVariant parentId, const QString parentType, const QVariant childId, const unsigned int parentCopyNumber, const unsigned int childPos, const QString childType, const unsigned int childCopyN)
+void GMDBManager::addChildPosition(const unsigned int &parentId, const std::string &parentType, const unsigned int &childId, const unsigned int &parentCopyNumber, const unsigned int &childPos, const std::string &childType, const unsigned int &childCopyN)
 {
 	if (m_deepDebug) qDebug() << "GMDBManager::addChildPosition(" << parentId << "," << parentType << "," << QString::number(parentCopyNumber) << "," <<childPos << "," << childType << ", " << childId << ", " << QString::number(childCopyN) << ")";
 
 	// get table name -- which the child ID refers to -- based on the child type
-	QVariant parentTableId = getTableIdFromNodeType(parentType);
-	QVariant childTableId = getTableIdFromNodeType(childType);
+	const unsigned int parentTableId = getTableIdFromNodeType(parentType);
+	const unsigned int childTableId = getTableIdFromNodeType(childType);
 
-	QString tableName = "ChildrenPositions";
-	QStringList cols = getTableColumnNames(tableName);
+  std::string tableName = "ChildrenPositions";
+  std::vector<std::string> cols = getTableColumnNames(tableName);
 
-	QString queryStr = QString("insert into %1(%2, %3, %4, %5, %6, %7, %8) values(?, ?, ?, ?, ?, ?, ?)").arg(tableName);
+	QString queryStr = QString("insert into %1(%2, %3, %4, %5, %6, %7, %8) values(?, ?, ?, ?, ?, ?, ?)").arg( QString::fromStdString(tableName) );
 	for (int i=0; i < cols.size(); ++i) {
 		if (i != 0) // skip the "id" column
-			queryStr = queryStr.arg( cols.at(i) );
+			queryStr = queryStr.arg( QString::fromStdString( cols.at(i)) );
 	}
 	if (m_deepDebug) qDebug() << "queryStr:" << queryStr;
 	QSqlQuery q;
@@ -931,48 +943,50 @@ void GMDBManager::addDBversion(const QString version)
 }
 
 
-QStringList GMDBManager::getItem(QString geoType, unsigned int id)
+std::vector<std::string> GMDBManager::getItem(std::string geoType, unsigned int id)
 {
 	if (m_deepDebug) qDebug() << "GMDBManager::getItem(geoType, id)"<< geoType << QString::number(id);
 
 	/* Get the right DB table */
-	QString tableName = getTableNameFromNodeType(geoType);
+  std::string tableName = getTableNameFromNodeType(geoType);
 	return getItemFromTableName(tableName, id);
 }
 
 
-QStringList GMDBManager::getItem(unsigned int tableId, unsigned int id)
+std::vector<std::string> GMDBManager::getItem(unsigned int tableId, unsigned int id)
 {
 	if (m_deepDebug) qDebug() << "GMDBManager::getItem(tableId, id)"<< QString::number(tableId) << QString::number(id);
 	/* Get the right DB table */
-	QString tableName = getTableNameFromTableId(tableId);
+  std::string tableName = getTableNameFromTableId(tableId);
 	return getItemFromTableName(tableName, id);
 
 }
 
+/*
 QStringList GMDBManager::getItemAndType(unsigned int tableId, unsigned int id)
 {
 	if (m_deepDebug) qDebug() << "GMDBManager::getItemAndType(tableId, id)"<< QString::number(tableId) << QString::number(id);
-	/* Get the right DB table */
-	QString tableName = getTableNameFromTableId(tableId);
+	// Get the right DB table
+  std::string tableName = getTableNameFromTableId(tableId);
 
-	QString nodeType = getNodeTypeFromTableId(tableId);
+  std::string nodeType = getNodeTypeFromTableId(tableId);
 
 	QStringList results;
-	QStringList item =  getItemFromTableName(tableName, id);
+  std::vector<std::string> item =  getItemFromTableName(tableName, id);
 
 	results << nodeType << item;
 
 	return results;
 
 }
-std::vector<std::string> GMDBManager::getItemAndTypeStd(unsigned int tableId, unsigned int id)
+*/
+std::vector<std::string> GMDBManager::getItemAndType(unsigned int tableId, unsigned int id)
 {
   std::vector<std::string> results;
   
-  QString tableName = getTableNameFromTableId(tableId);
-  std::string nodeType  = getNodeTypeFromTableIdStd(tableId);
-  std::vector<std::string> item  =  getItemFromTableNameStd(tableName, id);
+  std::string tableName = getTableNameFromTableId(tableId);
+  std::string nodeType  = getNodeTypeFromTableId(tableId);
+  std::vector<std::string> item  =  getItemFromTableName(tableName, id);
 
   // add the type
   results.push_back( nodeType );
@@ -983,13 +997,13 @@ std::vector<std::string> GMDBManager::getItemAndTypeStd(unsigned int tableId, un
   
 }
 
-
-QStringList GMDBManager::getItemFromTableName(QString tableName, unsigned int id)
+/*
+QStringList GMDBManager::getItemFromTableName(std::string tableName, unsigned int id)
 {
 	if (m_deepDebug) qDebug() << "GMDBManager::getItemFromTableName(tableName, id)"<< tableName << QString::number(id);
-	/*
-	 * 2. Get the object from DB
-	 */
+ 
+	 // 2. Get the object from DB
+ 
 	// prepare a SQL string with the right table name
 	QString queryStr = QString("SELECT * FROM %1 WHERE id = (?)").arg(tableName);
 	// prepare the query
@@ -1004,7 +1018,7 @@ QStringList GMDBManager::getItemFromTableName(QString tableName, unsigned int id
 	QStringList params;
 
 	// get the number of columns of the DB table
-	int nCols = (m_tableNames[tableName]).size();
+	int nCols = (m_tableNames.at(tableName.toStdString())).size();
 
 	while (q.next()) {
 
@@ -1016,15 +1030,16 @@ QStringList GMDBManager::getItemFromTableName(QString tableName, unsigned int id
 	}
 	return params;
 }
+    */
 
-std::vector<std::string> GMDBManager::getItemFromTableNameStd(QString tableName, unsigned int id)
+std::vector<std::string> GMDBManager::getItemFromTableName(std::string tableName, unsigned int id)
 {
   if (m_deepDebug) qDebug() << "GMDBManager::getItemFromTableName(tableName, id)"<< tableName << QString::number(id);
   /*
    * 2. Get the object from DB
    */
   // prepare a SQL string with the right table name
-  QString queryStr = QString("SELECT * FROM %1 WHERE id = (?)").arg(tableName);
+  QString queryStr = QString("SELECT * FROM %1 WHERE id = (?)").arg(QString::fromStdString(tableName));
   // prepare the query
   QSqlQuery q;
   if (!q.prepare( queryStr )) {
@@ -1038,7 +1053,7 @@ std::vector<std::string> GMDBManager::getItemFromTableNameStd(QString tableName,
   std::vector<std::string> params;
   
   // get the number of columns of the DB table
-  int nCols = (m_tableNames[tableName]).size();
+  int nCols = (m_tableNames.at(tableName)).size();
   
   while (q.next()) {
     
@@ -1046,18 +1061,18 @@ std::vector<std::string> GMDBManager::getItemFromTableNameStd(QString tableName,
       params.push_back( q.value(ii).toString().toStdString() );
   }
   if (params.size()==0) {
-    qWarning() << "WARNING!!" << "Item" << id << "does not exist in table" << tableName << "!!";
+    std::cout << "WARNING!!" << "Item" << id << "does not exist in table" << tableName << "!!";
   }
   return params;
 }
 
 
 // get the list of children for a single GeoVPhysVol (i.e., GeoPhysVol or GeoFullPhysVol)
-QMap<unsigned int, QStringList> GMDBManager::getVPhysVolChildren(const unsigned int id, const QString nodeType, const unsigned int parentCopyNumber)
+QMap<unsigned int, QStringList> GMDBManager::getVPhysVolChildren(const unsigned int &id, const std::string &nodeType, const unsigned int &parentCopyNumber)
 {
 	if (m_deepDebug) qDebug() << "GMDBManager::getVPhysVolChildren() - id:" << QString::number(id) << "- type:" << nodeType << "- copyN:" << QString::number(parentCopyNumber);
 
-	QVariant tableId = getTableIdFromNodeType(nodeType);
+	const unsigned int tableId = getTableIdFromNodeType(nodeType);
 
 	// get children and their positions
 	QSqlQuery q;
@@ -1167,15 +1182,15 @@ std::vector<std::vector<std::string>> GMDBManager::getChildrenTableStd()
 
 
 
-QVariant GMDBManager::getTableIdFromNodeType(QString nodeType)
+unsigned int GMDBManager::getTableIdFromNodeType(const std::string &nodeType)
 {
 	// JFB commented: qDebug() << "GMDBManager::getTableIdFromNodeType("<< nodeType <<")";
 	QSqlQuery q;
 	if (!q.prepare(QLatin1String("SELECT id FROM GeoNodesTypes WHERE nodeType = (?)"))) {
 		showError(q.lastError());
-		return QVariant();
+    exit(EXIT_FAILURE);
 	}
-	q.addBindValue(nodeType);
+  q.addBindValue(QString::fromStdString(nodeType));
 	q.exec();
 
 	QVariant id;
@@ -1184,7 +1199,7 @@ QVariant GMDBManager::getTableIdFromNodeType(QString nodeType)
 		// JFB commented: qDebug() << "id:" << id;
 	}
 
-	return id;
+	return id.toUInt();
 }
 
 QString GMDBManager::getTableNameFromNodeType(QString nodeType)
@@ -1207,7 +1222,29 @@ QString GMDBManager::getTableNameFromNodeType(QString nodeType)
 	return tableName;
 }
 
+      std::string GMDBManager::getTableNameFromNodeType(std::string nodeType)
+      {
+        QSqlQuery q;
+        if (!q.prepare(QLatin1String("SELECT tableName FROM GeoNodesTypes WHERE nodeType = (?)"))) {
+          showError(q.lastError());
+//          return QString();
+          exit(EXIT_FAILURE);
+        }
+        q.addBindValue(QString::fromStdString(nodeType));
+        q.exec();
+        
+        std::string tableName;
+        while (q.next()) {
+          tableName = q.value(0).toString().toStdString();
+        }
+        
+        return tableName;
+      }
+      
+      
+
 // TODO: this and other methods could take data from in-memory maps, without asking to the DB all the times
+/*
 QString GMDBManager::getTableNameFromTableId(unsigned int tabId)
 {
 	QSqlQuery q;
@@ -1226,7 +1263,10 @@ QString GMDBManager::getTableNameFromTableId(unsigned int tabId)
 
 	return tableName;
 }
-std::string GMDBManager::getTableNameFromTableIdStd(unsigned int tabId)
+ */
+
+
+std::string GMDBManager::getTableNameFromTableId(unsigned int tabId)
 {
   QSqlQuery q;
   if (!q.prepare(QLatin1String("SELECT tableName FROM GeoNodesTypes WHERE id = (?)"))) {
@@ -1244,7 +1284,7 @@ std::string GMDBManager::getTableNameFromTableIdStd(unsigned int tabId)
   
   return tableName;
 }
-
+/*
 QString GMDBManager::getNodeTypeFromTableId(unsigned int tabId)
 {
 	QSqlQuery q;
@@ -1262,7 +1302,8 @@ QString GMDBManager::getNodeTypeFromTableId(unsigned int tabId)
 
 	return nodeType;
 }
-std::string GMDBManager::getNodeTypeFromTableIdStd(unsigned int tabId)
+ */
+std::string GMDBManager::getNodeTypeFromTableId(unsigned int tabId)
 {
   QSqlQuery q;
   if (!q.prepare(QLatin1String("SELECT nodeType FROM GeoNodesTypes WHERE id = (?)"))) {
@@ -1280,7 +1321,7 @@ std::string GMDBManager::getNodeTypeFromTableIdStd(unsigned int tabId)
   
   return nodeType;
 }
-
+/*
 QHash<unsigned int, QString> GMDBManager::getAll_TableIDsNodeTypes()
 {
 	// JFB commented: qDebug() << "GMDBManager::getAll_TableIDsNodeTypes()";
@@ -1299,14 +1340,10 @@ QHash<unsigned int, QString> GMDBManager::getAll_TableIDsNodeTypes()
 	}
 	return output;
 }
-
-std::unordered_map<unsigned int, std::string> GMDBManager::getAll_TableIDsNodeTypesStd()
+*/
+std::unordered_map<unsigned int, std::string> GMDBManager::getAll_TableIDsNodeTypes()
 {
-  // JFB commented: qDebug() << "GMDBManager::getAll_TableIDsNodeTypes()";
-  
-//  QHash<unsigned int, QString> output;
   std::unordered_map<unsigned int, std::string> output;
-  
   QSqlQuery q = selectAllFromTable("GeoNodesTypes");
   
   unsigned int id;
@@ -1320,6 +1357,7 @@ std::unordered_map<unsigned int, std::string> GMDBManager::getAll_TableIDsNodeTy
   return output;
 }
 
+/*
 QHash<QString, unsigned int> GMDBManager::getAll_NodeTypesTableIDs()
 {
 	// JFB commented: qDebug() << "GMDBManager::getAll_NodeTypesTableIDs()";
@@ -1338,12 +1376,11 @@ QHash<QString, unsigned int> GMDBManager::getAll_NodeTypesTableIDs()
 	}
 	return output;
 }
+*/
 
-std::unordered_map<std::string, unsigned int> GMDBManager::getAll_NodeTypesTableIDsStd()
+std::unordered_map<std::string, unsigned int> GMDBManager::getAll_NodeTypesTableIDs()
 {
-//  QHash<QString, unsigned int> output;
   std::unordered_map<std::string, unsigned int> output;
-  
   QSqlQuery q = selectAllFromTable("GeoNodesTypes");
   
   unsigned int id;
@@ -1358,24 +1395,31 @@ std::unordered_map<std::string, unsigned int> GMDBManager::getAll_NodeTypesTable
 }
 
 
-QSqlQuery GMDBManager::selectAllFromTable(QString tableName) const
-{
-//  QSqlQuery q;
-//
-//  QString queryStr = QString("SELECT * FROM %1 ORDER BY id");
-//  queryStr = queryStr.arg(tableName);
+//QSqlQuery GMDBManager::selectAllFromTable(QString tableName) const
+//{
+////  QSqlQuery q;
+////
+////  QString queryStr = QString("SELECT * FROM %1 ORDER BY id");
+////  queryStr = queryStr.arg(tableName);
+////
+////  if (!q.prepare(queryStr)) {
+////    showError(q.lastError());
+////    return QSqlQuery();
+////  }
+////  q.exec();
+////  return q;
 //
-//  if (!q.prepare(queryStr)) {
-//    showError(q.lastError());
-//    return QSqlQuery();
-//  }
-//  q.exec();
-//  return q;
-  
+//  return selectAllFromTableSortBy(tableName.toStdString(), "id");
+//}
+
+QSqlQuery GMDBManager::selectAllFromTable(std::string tableName) const
+{
   return selectAllFromTableSortBy(tableName, "id");
 }
 
-QSqlQuery GMDBManager::selectAllFromTableSortBy(QString tableName, std::string sortColumn) const
+      
+      
+      QSqlQuery GMDBManager::selectAllFromTableSortBy(std::string tableName, std::string sortColumn) const
 {
   QSqlQuery q;
   
@@ -1385,7 +1429,7 @@ QSqlQuery GMDBManager::selectAllFromTableSortBy(QString tableName, std::string s
   QString qsortColumn = QString::fromStdString(sortColumn);
   
   QStringList args;
-  args << tableName << qsortColumn;
+  args << QString::fromStdString(tableName) << qsortColumn;
   
   QString queryStr = QString("SELECT * FROM %1 ORDER BY %2");
 //  queryStr = queryStr.arg(tableName);
@@ -1440,36 +1484,41 @@ bool GMDBManager::initDB()
 
 bool GMDBManager::createTables()
 {
-	// JFB commented: qDebug() << "GMDBManager::createTables()";
-
-	QStringList tab;
+//  QStringList tab;
 	QSqlQuery q;
-	QString geoNode;
-	QString tableName;
-	QString queryStr;
-  
+  QString queryStr;
   
+  std::string geoNode;
+  std::string tableName;
+  std::vector<std::string> tab;
+//  std::vector<std::string>::iterator it;
   
-
-	// create a table to store the relation between the types of GeoNodes and the name of the table
+  // create a table to store the relation between the types of GeoNodes and the name of the table
 	tableName = "dbversion";
-	tab << tableName << "id" << "version";
+//  tab << tableName << "id" << "version";
+  tab.push_back(tableName); // TODO: find a nicer and faster way compared to this chain of push_back()...
+  tab.push_back("id");
+  tab.push_back("version" );
 	queryStr = QString("create table %1(%2 integer primary key, %3 integer)");
 	for (int i=0; i < tab.size(); ++i) {
-		queryStr = queryStr.arg( tab.at(i) );
+    queryStr = queryStr.arg( QString::fromStdString(tab.at(i)) );
 	}
 	//qDebug() << "query:" << queryStr;
 	if (!q.exec(queryStr)) {
 		showError(q.lastError());
 		return false;
 	}
-	storeTableColumnNames(toStdVectorStrings(tab));
+	storeTableColumnNames(tab);
 	tab.clear();
 
 	// create a table to store the relation between the types of GeoNodes and the name of the table
 	tableName = "GeoNodesTypes";
-	tab << tableName << "id" << "nodeType" << "tableName";
-	storeTableColumnNames(toStdVectorStrings(tab));
+//  tab << tableName << "id" << "nodeType" << "tableName";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("nodeType");
+  tab.push_back("tableName");
+	storeTableColumnNames(tab);
 	tab.clear();
 	if (!q.exec(QLatin1String("create table GeoNodesTypes(id integer primary key, nodeType varchar, tableName varchar)"))) {
 		showError(q.lastError());
@@ -1478,43 +1527,60 @@ bool GMDBManager::createTables()
 
 	// ChildrenPositions table
 	tableName = "ChildrenPositions";
-	tab << tableName << "id" << "parentId" << "parentTable" << "parentCopyNumber" << "position" << "childTable" << "childId" << "childCopyNumber";
+//  tab << tableName << "id" << "parentId" << "parentTable" << "parentCopyNumber" << "position" << "childTable" << "childId" << "childCopyNumber";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("parentId");
+  tab.push_back("parentTable");
+  tab.push_back("parentCopyNumber");
+  tab.push_back("position");
+  tab.push_back("childTable");
+  tab.push_back("childId");
+  tab.push_back("childCopyNumber");
 	queryStr = QString("create table %1(%2 integer primary key, %3 integer, %4 integer not null REFERENCES GeoNodesTypes(id), %5 integer, %6 integer, %7 integer not null REFERENCES GeoNodesTypes(id), %8 integer not null, %9 integer)"); // FIXME: add "NOT NULL" to copy numbers
 	for (int i=0; i < tab.size(); ++i) {
-		queryStr = queryStr.arg( tab.at(i) );
+		queryStr = queryStr.arg( QString::fromStdString(tab.at(i)) );
 	}
 	// qDebug() << "query:" << queryStr;
 	if (!q.exec(queryStr)) {
 		showError(q.lastError());
 		return false;
 	}
-	storeTableColumnNames(toStdVectorStrings(tab));
+	storeTableColumnNames(tab);
 	tab.clear();
 
 
 	// RootVolume table
 	tableName = "RootVolume";
-	tab << tableName << "id" << "volId" << "volTable";
+//  tab << tableName << "id" << "volId" << "volTable";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("volId");
+  tab.push_back("volTable");
 	queryStr = QString("create table %1(%2 integer primary key, %3 integer not null, %4 integer not null REFERENCES GeoNodesTypes(id))");
 	for (int i=0; i < tab.size(); ++i) {
-		queryStr = queryStr.arg( tab.at(i) );
+		queryStr = queryStr.arg( QString::fromStdString(tab.at(i)) );
 	}
 	//qDebug() << "query:" << queryStr;
 	if (!q.exec(queryStr)) {
 		showError(q.lastError());
 		return false;
 	}
-	storeTableColumnNames(toStdVectorStrings(tab));
+	storeTableColumnNames(tab);
 	tab.clear();
 
 
 	// PhysVols table
 	geoNode = "GeoPhysVol";
 	tableName = "PhysVols";
-	tab << tableName << "id" << "logvol" << "parent"; // FIXME: remove "parent" field, it is not used anymore and it's not reliable since it's not using the tableID.
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "logvol" << "parent"; // FIXME: remove "parent" field, it is not used anymore and it's not reliable since it's not using the tableID.
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("logvol");
+  tab.push_back("parent");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table PhysVols(id integer primary key, logvol integer not null, parent integer)"))) {
 		showError(q.lastError());
 		return false;
@@ -1525,10 +1591,14 @@ bool GMDBManager::createTables()
 	// FullPhysVols table
 	geoNode = "GeoFullPhysVol";
 	tableName = "FullPhysVols";
-	tab << tableName << "id" << "logvol" << "parent";
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "logvol" << "parent";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("logvol");
+  tab.push_back("parent");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table FullPhysVols(id integer primary key, logvol integer not null, parent integer)"))) {
 		showError(q.lastError());
 		return false;
@@ -1539,10 +1609,15 @@ bool GMDBManager::createTables()
 	// LogVols table
 	geoNode = "GeoLogVol";
 	tableName = "LogVols";
-	tab << tableName << "id" << "name" << "shape" << "material";
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "name" << "shape" << "material";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("name");
+  tab.push_back("shape");
+  tab.push_back("material");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table LogVols(id integer primary key, name varchar, shape integer not null, material integer not null)"))) {
 		showError(q.lastError());
 		return false;
@@ -1553,10 +1628,15 @@ bool GMDBManager::createTables()
 	// Materials table
 	geoNode = "GeoMaterial";
 	tableName = "Materials";
-	tab << tableName << "id" << "name" << "density" << "elements";
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "name" << "density" << "elements";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("name");
+  tab.push_back("density");
+  tab.push_back("elements");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table Materials(id integer primary key, name varchar, density varchar, elements varchar)"))) {
 		showError(q.lastError());
 		return false;
@@ -1567,10 +1647,16 @@ bool GMDBManager::createTables()
 	// Elements table
 	geoNode = "GeoElement";
 	tableName = "Elements";
-	tab << tableName << "id" << "name" << "symbol" << "Z" << "A";
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "name" << "symbol" << "Z" << "A";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("name");
+  tab.push_back("symbol");
+  tab.push_back("Z");
+  tab.push_back("A");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table Elements(id integer primary key, name varchar, symbol varchar, Z varchar, A varchar)"))) {
 		showError(q.lastError());
 		return false;
@@ -1581,10 +1667,14 @@ bool GMDBManager::createTables()
 	// Shapes table
 	geoNode = "GeoShape";
 	tableName = "Shapes";
-	tab << tableName << "id" << "type" << "parameters";
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "type" << "parameters";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("type");
+  tab.push_back("parameters");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table Shapes(id integer primary key, type varchar, parameters varchar)"))) {
 		showError(q.lastError());
 		return false;
@@ -1595,10 +1685,13 @@ bool GMDBManager::createTables()
 	// SerialDenominators table
 	geoNode = "GeoSerialDenominator";
 	tableName = "SerialDenominators";
-	tab << tableName << "id" << "baseName";
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "baseName";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("baseName");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table SerialDenominators(id integer primary key, baseName varchar)"))) {
 		showError(q.lastError());
 		return false;
@@ -1609,10 +1702,13 @@ bool GMDBManager::createTables()
 	// Functions table
 	geoNode = "Function";
 	tableName = "Functions";
-	tab << tableName << "id" << "expression";
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "expression";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("expression");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table Functions(id integer primary key, expression varchar)"))) {
 		showError(q.lastError());
 		return false;
@@ -1624,11 +1720,17 @@ bool GMDBManager::createTables()
 	geoNode = "GeoSerialTransformer";
 	tableName = "SerialTransformers";
 	m_childType_tableName[geoNode] = tableName; // store type-table relation
-	tab << tableName << "id" << "funcId" << "volId" << "volTable" << "copies";
-	storeTableColumnNames(toStdVectorStrings(tab));
+//  tab << tableName << "id" << "funcId" << "volId" << "volTable" << "copies";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("funcId");
+  tab.push_back("volId");
+  tab.push_back("volTable");
+  tab.push_back("copies");
+	storeTableColumnNames(tab);
 	queryStr = QString("create table %1(%2 integer primary key, %3 integer not null REFERENCES Functions(id), %4 integer not null, %5 integer not null REFERENCES GeoNodesTypes(id), %6 integer)");
 	for (int i=0; i < tab.size(); ++i) {
-		queryStr = queryStr.arg( tab.at(i) );
+		queryStr = queryStr.arg( QString::fromStdString(tab.at(i)) );
 	}
 	tab.clear();
 	// qDebug() << "query:" << queryStr;
@@ -1643,10 +1745,24 @@ bool GMDBManager::createTables()
 	// Transforms table
 	geoNode = "GeoTransform";
 	tableName = "Transforms";
-	tab << tableName << "id" << "xx" << "xy" << "xz" << "yx" << "yy" << "yz" << "zx" << "zy" << "zz" << "dx" << "dy" << "dz";
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "xx" << "xy" << "xz" << "yx" << "yy" << "yz" << "zx" << "zy" << "zz" << "dx" << "dy" << "dz";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("xx");
+  tab.push_back("xy");
+  tab.push_back("xz");
+  tab.push_back("yx");
+  tab.push_back("yy");
+  tab.push_back("yz");
+  tab.push_back("zx");
+  tab.push_back("zy");
+  tab.push_back("zz");
+  tab.push_back("dx");
+  tab.push_back("dy");
+  tab.push_back("dz");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table Transforms(id integer primary key, xx real, xy real, xz real, yx real, yy real, yz real, zx real, zy real, zz real, dx real, dy real, dz real)"))) {
 		showError(q.lastError());
 		return false;
@@ -1657,10 +1773,24 @@ bool GMDBManager::createTables()
 	// AlignableTransforms table
 	geoNode = "GeoAlignableTransform";
 	tableName = "AlignableTransforms";
-	tab << tableName << "id" << "xx" << "xy" << "xz" << "yx" << "yy" << "yz" << "zx" << "zy" << "zz" << "dx" << "dy" << "dz";
-	storeTableColumnNames(toStdVectorStrings(tab));
+  m_childType_tableName[geoNode] = tableName; // store type-table relation
+//  tab << tableName << "id" << "xx" << "xy" << "xz" << "yx" << "yy" << "yz" << "zx" << "zy" << "zz" << "dx" << "dy" << "dz";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("xx");
+  tab.push_back("xy");
+  tab.push_back("xz");
+  tab.push_back("yx");
+  tab.push_back("yy");
+  tab.push_back("yz");
+  tab.push_back("zx");
+  tab.push_back("zy");
+  tab.push_back("zz");
+  tab.push_back("dx");
+  tab.push_back("dy");
+  tab.push_back("dz");
+	storeTableColumnNames(tab);
 	tab.clear();
-	m_childType_tableName[geoNode] = tableName; // store type-table relation
 	if (!q.exec(QLatin1String("create table AlignableTransforms(id integer primary key, xx real, xy real, xz real, yx real, yy real, yz real, zx real, zy real, zz real, dx real, dy real, dz real)"))) {
 		showError(q.lastError());
 		return false;
@@ -1672,11 +1802,14 @@ bool GMDBManager::createTables()
 	geoNode = "GeoNameTag";
 	tableName = "NameTags";
 	m_childType_tableName[geoNode] = tableName; // store type-table relation
-	tab << tableName << "id" << "name";
-	storeTableColumnNames(toStdVectorStrings(tab));
+//  tab << tableName << "id" << "name";
+  tab.push_back(tableName);
+  tab.push_back("id");
+  tab.push_back("name");
+	storeTableColumnNames(tab);
 	queryStr = QString("create table %1(%2 integer primary key, %3 varchar)");
 	for (int i=0; i < tab.size(); ++i) {
-		queryStr = queryStr.arg( tab.at(i) );
+		queryStr = queryStr.arg( QString::fromStdString(tab.at(i)) );
 	}
 	tab.clear();
 	// qDebug() << "query:" << queryStr;
@@ -1687,22 +1820,19 @@ bool GMDBManager::createTables()
 		storeNodeType(geoNode, tableName);
 	}
 
-    // JFB commented: qDebug() << "m_childType_tableName:" << m_childType_tableName;
-	// JFB commented: qDebug() << "DONE. All tables created successfully.";
 	return true;
 
 }
 
 void GMDBManager::loadTableNamesFromDB()
 {
-	// JFB commented: qDebug() << "GMDBManager::loadTableNames()";
 	QSqlDatabase db = QSqlDatabase::database();
-	QStringList tables = db.tables();
-	foreach (QString tab, tables) {
-		QStringList tabColNames = getTableColNamesFromDB(tab);
+	QStringList qtables = db.tables();
+  std::vector<std::string> tables = toStdVectorStrings(qtables);
+  for ( auto& tab : tables) {
+    std::vector<std::string> tabColNames = getTableColNamesFromDB(tab);
 		storeTableColumnNames(tabColNames);
 	}
-	// qDebug() << "m_tableNames:" << m_tableNames;
 }
 
 //void GMDBManager::storeTableColumnNames(QStringList input)
@@ -1716,22 +1846,21 @@ void GMDBManager::loadTableNamesFromDB()
 
 void GMDBManager::storeTableColumnNames(std::vector<std::string> input)
 {
-  //  qDebug() << "GMDBManager::storeTableColumnNames()";
   if (! (input.size() == 0) ) {
-    std::string tabName = input.takeFirst(); // get the first element storing the name of the table
+    std::string tabName = input.at(0); // get the first element storing the name of the table
     input.erase(input.begin()); // remove the first element storing the name of the table
     m_tableNames[tabName] = input;
   }
 }
 
 
-QStringList GMDBManager::getTableColumnNames(QString tableName)
+std::vector<std::string> GMDBManager::getTableColumnNames(const std::string &tableName)
 {
 	//	qDebug() << "GMDBManager::getTableColumnNames()";
-	return m_tableNames[tableName];
+	return m_tableNames.at(tableName);
 }
 
-void GMDBManager::storeNodeType(QString nodeType, QString tableName)
+void GMDBManager::storeNodeType(std::string nodeType, std::string tableName)
 {
 	// JFB commented: qDebug() << "GMDBManager::storeNodeType()";
 
@@ -1741,12 +1870,14 @@ void GMDBManager::storeNodeType(QString nodeType, QString tableName)
 		return;
 	}
 
-	q.addBindValue(nodeType);
-	q.addBindValue(tableName);
+  q.addBindValue(QString::fromStdString(nodeType));
+  q.addBindValue(QString::fromStdString(tableName));
 	q.exec();
 	return;
 }
 
+
+
 void GMDBManager::loadTestData()
 {
 
@@ -1785,23 +1916,25 @@ void GMDBManager::loadTestData()
 }
 
 
-QStringList GMDBManager::getTableColNamesFromDB(QString tableName) const
+std::vector<std::string> GMDBManager::getTableColNamesFromDB(std::string tableName) const
 {
-	QStringList colNames;
-	colNames << tableName;
+  std::vector<std::string> colNames;
+	colNames. push_back( tableName );
 
 	// fetch the driver
 	QSqlDriver* driver = m_db.driver();
-	QSqlRecord record = driver->record(tableName);
-	int colN = record.count();
-	for (int i = 0; i < colN; ++i)
-		colNames << record.fieldName(i);
+  QSqlRecord record = driver->record(QString::fromStdString(tableName));
+	unsigned int colN = record.count();
+	for (unsigned int i = 0; i < colN; ++i)
+		colNames.push_back( record.fieldName(i).toStdString() );
 	return colNames;
 }
 
 
 
-void GMDBManager::printTableColNamesFromDB(QString tableName) const
+
+
+void GMDBManager::printTableColNamesFromDB(const std::string &tableName) const
 {
 	// JFB commented: qDebug() << "GMDBManager::printTableColNames:" << tableName;
 
@@ -1809,20 +1942,20 @@ void GMDBManager::printTableColNamesFromDB(QString tableName) const
 	// JFB commented: qDebug() << getTableColNamesFromDB(tableName);
 }
 
-bool GMDBManager::storeRootVolume(QVariant id, QString nodeType)
+bool GMDBManager::storeRootVolume(const unsigned int &id, const std::string &nodeType)
 {
 	// JFB commented: qDebug() << "GMDBManager::storeRootVolume:" << id << nodeType;
 
-	QVariant typeId = getTableIdFromNodeType(nodeType);
+	const unsigned int typeId = getTableIdFromNodeType(nodeType);
 
-	QString tableName = "RootVolume";
-	QStringList cols = getTableColumnNames(tableName);
+  std::string tableName = "RootVolume";
+  std::vector<std::string> cols = getTableColumnNames(tableName);
 
 	// prepare the query string
-	QString queryStr = QString("insert into %1(%2, %3) values(?, ?)").arg(tableName);
+	QString queryStr = QString("insert into %1(%2, %3) values(?, ?)").arg( QString::fromStdString(tableName) );
 	for (int i=0; i < cols.size(); ++i) {
 		if (i != 0) // skip the "id" column
-			queryStr = queryStr.arg( cols.at(i) );
+    queryStr = queryStr.arg( QString::fromStdString(cols.at(i)) );
 	}
 	//qDebug() << "queryStr:" << queryStr;
 	// prepare the query
@@ -1838,7 +1971,8 @@ bool GMDBManager::storeRootVolume(QVariant id, QString nodeType)
 	return true;
 }
 
-QStringList GMDBManager::getRootPhysVol()
+/*
+std::vector<std::string> GMDBManager::getRootPhysVol()
 {
   //JFB commented: qDebug() << "GMDBManager::getRootPhysVol()";
 	// get the ID of the ROOT vol from the table "RootVolume"
@@ -1853,8 +1987,9 @@ QStringList GMDBManager::getRootPhysVol()
 	}
 	return getItemAndType(typeId.toUInt(), id.toUInt());
 }
+*/
 
-std::vector<std::string> GMDBManager::getRootPhysVolStd()
+std::vector<std::string> GMDBManager::getRootPhysVol()
 {
   // get the ID of the ROOT vol from the table "RootVolume"
   QSqlQuery query = selectAllFromTable("RootVolume");
@@ -1865,19 +2000,31 @@ std::vector<std::string> GMDBManager::getRootPhysVolStd()
     id = query.value(1).toUInt();
     typeId = query.value(2).toUInt();
   }
-  return getItemAndTypeStd(typeId, id);
+  return getItemAndType(typeId, id);
 }
 
 
-QString GMDBManager::getDBFilePath()
+std::string GMDBManager::getDBFilePath()
 {
     return m_dbpath;
 }
 
+// TODO: move to an utility class
+int lastIndexOf(std::vector<std::string> v, std::string str, int pos = 0) {
+  auto it = std::find(std::next(v.rbegin(), v.size() - pos), v.rend(), str);
+  if (it != v.rend())
+  {
+    auto idx = std::distance(v.begin(), it.base() - 1);
+//    std::cout << idx << std::endl;
+    return idx;
+  }
+  return -1; // no item matched
+}
 
-int GMDBManager::getTableColIndex(QString tableName, QString colName)
+int GMDBManager::getTableColIndex(const std::string &tableName, const std::string &colName)
 {
-	//qDebug() << "GMDBManager::getTableColIndex()";
-	QStringList colFields = m_tableNames[tableName];
-	return colFields.lastIndexOf(colName);
+  std::vector<std::string> colFields = m_tableNames.at(tableName);
+	return lastIndexOf(colFields, colName);
 }
+
+
diff --git a/GeoModelWrite/GeoModelWrite/WriteGeoModel.h b/GeoModelWrite/GeoModelWrite/WriteGeoModel.h
index 95d6a66f601aa0defb73f498ad2d346beade9c2b..bb882c500f63c3fb77b81d31e9036d9966bdf56a 100644
--- a/GeoModelWrite/GeoModelWrite/WriteGeoModel.h
+++ b/GeoModelWrite/GeoModelWrite/WriteGeoModel.h
@@ -1,8 +1,10 @@
 /*
  * author: Riccardo.Maria.Bianchi@cern.ch, 2017
  *
- * major updates: Aug 2018 rbianchi
- *                Feb 2019 rbianchi
+ * major updates:
+ * - Aug 2018 - R.M.Bianchi
+ * - Feb 2019 - R.M.Bianchi
+ * - May 2020 - R.M.Bianchi
  */
 
 #ifndef GeoModelWrite_WriteGeoModel_H
@@ -22,16 +24,10 @@
 #include "GeoModelKernel/GeoAlignableTransform.h"
 #include "GeoModelKernel/GeoDefinitions.h"
 
-// Qt includes
-//#include <QSqlDatabase>
-#include <QStringList>
-#include <QVariant>
-#include <QString>
-#include <QMap>
-
 // C++ includes
 #include <vector>
 #include <string>
+#include <unordered_map>
 
 
 namespace GeoModelIO {
@@ -81,83 +77,82 @@ private:
 
 	void showMemoryMap();
 
-	QStringList getParentNode();
-
-	QVariant storeShape(const GeoShape* shape);
-	QVariant storeMaterial(const GeoMaterial* mat);
-	QVariant storeElement(const GeoElement* el);
-	QVariant storeTranform(const GeoTransform* node);
-
-	QVariant storeObj(const GeoMaterial* pointer, const QString name, const QString density, const QString elements);
-	QVariant storeObj(const GeoElement* pointer, const QString name, const QString symbol, const QString elZ, const QString elA);
-  QVariant storeObj(const GeoShape* pointer, const std::string type, const std::string parameters);
-	QVariant storeObj(const GeoLogVol* pointer, const QString name, const QVariant shapeId, const QVariant materialId);
-	QVariant storeObj(const GeoPhysVol* pointer, const QVariant logvolId, const QVariant parentId = QVariant(), bool isRootVolume = false );
-	QVariant storeObj(const GeoFullPhysVol* pointer, const QVariant logvolId, const QVariant parentId = QVariant(), bool isRootVolume = false );
-	QVariant storeObj(const GeoSerialDenominator* pointer, const QString baseName);
-	QVariant storeObj(const GeoSerialTransformer* pointer, const QVariant functionId, const QVariant volId, const QString volType, const unsigned int copies);
-	QVariant storeObj(const GeoXF::Function* pointer, const QString expression);
-	QVariant storeObj(const GeoTransform* pointer, const std::vector<double> parameters);
-	QVariant storeObj(const GeoAlignableTransform* pointer, const std::vector<double> parameters);
-	QVariant storeObj(const GeoNameTag* pointer, const QString name);
-
-  unsigned int addRecord(std::vector<QStringList>* container, const QStringList values) const;
+  std::vector<std::string> getParentNode();
+
+	unsigned int storeShape(const GeoShape* shape);
+	unsigned int storeMaterial(const GeoMaterial* mat);
+	unsigned int storeElement(const GeoElement* el);
+	unsigned int storeTranform(const GeoTransform* node);
+
+	unsigned int storeObj(const GeoMaterial* pointer, const std::string &name, const double &density, const std::string &elements);
+  unsigned int storeObj(const GeoElement* pointer, const std::string &name, const std::string &symbol, const double &elZ, const double &elA);
+  unsigned int storeObj(const GeoShape* pointer, const std::string &type, const std::string &parameters);
+  unsigned int storeObj(const GeoLogVol* pointer, const std::string &name, const unsigned int &shapeId, const unsigned int &materialId);
+	unsigned int storeObj(const GeoPhysVol* pointer, const unsigned int &logvolId, const unsigned int parentId = 0, const bool isRootVolume = false );
+	unsigned int storeObj(const GeoFullPhysVol* pointer, const unsigned int &logvolId, const unsigned int parentId = 0, const bool isRootVolume = false );
+  unsigned int storeObj(const GeoSerialDenominator* pointer, const std::string &baseName);
+  unsigned int storeObj(const GeoSerialTransformer* pointer, const unsigned int &functionId, const unsigned int &volId, const std::string &volType, const unsigned int &copies);
+  unsigned int storeObj(const GeoXF::Function* pointer, const std::string &expression);
+	unsigned int storeObj(const GeoTransform* pointer, const std::vector<double> &parameters);
+	unsigned int storeObj(const GeoAlignableTransform* pointer, const std::vector<double> &parameters);
+  unsigned int storeObj(const GeoNameTag* pointer, const std::string &name);
+
   unsigned int addRecord(std::vector<std::vector<std::string>>* container, const std::vector<std::string> values) const;
   
-	QVariant addMaterial(const QString name, const QString density, const QString elements);
-	QVariant addElement(const QString name, const QString symbol, const QString elZ, const QString elA);
-	QVariant addNameTag(const QString name);
-	QVariant addAlignableTransform(const std::vector<double> params);
-	QVariant addTransform(const std::vector<double> params);
-	QVariant addFunction(const QString expression);
-	QVariant addSerialTransformer(const QVariant &funcId, const QVariant &physvolId, const QString volType, const unsigned int &copies);
-  QVariant addShape(const std::string &type, const std::string &parameters);
-	QVariant addSerialDenominator(const QString &baseName);
-	QVariant addPhysVol(const QVariant &logVolId, const QVariant &parentPhysVolId, bool isRootVolume = false);
-	QVariant addFullPhysVol(const QVariant &logVolId, const QVariant &parentPhysVolId, bool isRootVolume = false);
-	QVariant addLogVol(const QString &name, const QVariant &shapeId, const QVariant &materialId);
-	void addChildPosition(const QVariant parentId, const QString parentType, const QVariant childId, const unsigned int parentCopyNumber, const unsigned int childPos, const QString childType, const unsigned int childCopyN);
-
-	unsigned int getChildPosition(QString parentId, QString parentType, unsigned int copyN);
-
-	unsigned int setVolumeCopyNumber(QString volId, QString volType);
-	unsigned int getLatestParentCopyNumber(QString parentId, QString parentType);
-
-	void storeChildPosition(const QVariant parentId, const QString parentType, const QVariant childVol, const unsigned int parentCopyNumber, const unsigned int childPos, const QString childType, const unsigned int childCopyN);
-
-	bool isAddressStored(const QString address);
-	void storeAddress(const QString address, QVariant id);
-
-	QVariant getStoredIdFromAddress(QString address);
-
-	QString getAddressStringFromPointer(const GeoMaterial* pointer);
-	QString getAddressStringFromPointer(const GeoElement* pointer);
-	QString getAddressStringFromPointer(const GeoShape* pointer);
-	QString getAddressStringFromPointer(const GeoLogVol* pointer);
-	QString getAddressStringFromPointer(const GeoPhysVol* pointer);
-	QString getAddressStringFromPointer(const GeoVPhysVol* pointer);
-	QString getAddressStringFromPointer(const GeoSerialDenominator* pointer);
-	QString getAddressStringFromPointer(const GeoSerialTransformer* pointer);
-	QString getAddressStringFromPointer(const GeoXF::Function* pointer);
-	QString getAddressStringFromPointer(const GeoTransform* pointer);
-	QString getAddressStringFromPointer(const GeoNameTag* pointer);
-
-	QString getQStringFromOss(std::ostringstream &oss);
+  unsigned int addMaterial(const std::string &name, const double &density, const std::string &elements);
+  unsigned int addElement(const std::string &name, const std::string &symbol, const double &elZ, const double &elA);
+  unsigned int addNameTag(const std::string &name);
+	unsigned int addAlignableTransform(const std::vector<double> &params);
+	unsigned int addTransform(const std::vector<double> &params);
+  unsigned int addFunction(const std::string &expression);
+  unsigned int addSerialTransformer(const unsigned int &funcId, const unsigned int &physvolId, const std::string volType, const unsigned int &copies);
+  unsigned int addShape(const std::string &type, const std::string &parameters);
+  unsigned int addSerialDenominator(const std::string &baseName);
+	unsigned int addPhysVol(const unsigned int &logVolId, const unsigned int &parentPhysVolId, const bool &isRootVolume);
+	unsigned int addFullPhysVol(const unsigned int &logVolId, const unsigned int &parentPhysVolId, const bool &isRootVolume);
+  unsigned int addLogVol(const std::string &name, const unsigned int &shapeId, const unsigned int &materialId);
+  void addChildPosition(const unsigned int &parentId, const std::string &parentType, const unsigned int &childId, const unsigned int &parentCopyNumber, const unsigned int &childPos, const std::string &childType, const unsigned int &childCopyN);
+
+	unsigned int getChildPosition(const unsigned int &parentId, const std::string &parentType, const unsigned int &copyN);
+
+  unsigned int setVolumeCopyNumber(const unsigned int& volId, const std::string& volType);
+  unsigned int getLatestParentCopyNumber(const unsigned int& parentId, const std::string& parentType);
+
+	void storeChildPosition(const unsigned int& parentId, const std::string& parentType, const unsigned int& childVol, const unsigned int& parentCopyNumber, const unsigned int& childPos, const std::string& childType, const unsigned int& childCopyN);
+
+	bool isAddressStored(const std::string &address);
+	void storeAddress(const std::string &address, const unsigned int &id);
+
+  unsigned int getStoredIdFromAddress(const std::string &address);
+
+	std::string getAddressStringFromPointer(const GeoMaterial* pointer);
+	std::string getAddressStringFromPointer(const GeoElement* pointer);
+	std::string getAddressStringFromPointer(const GeoShape* pointer);
+	std::string getAddressStringFromPointer(const GeoLogVol* pointer);
+	std::string getAddressStringFromPointer(const GeoPhysVol* pointer);
+	std::string getAddressStringFromPointer(const GeoVPhysVol* pointer);
+	std::string getAddressStringFromPointer(const GeoSerialDenominator* pointer);
+	std::string getAddressStringFromPointer(const GeoSerialTransformer* pointer);
+	std::string getAddressStringFromPointer(const GeoXF::Function* pointer);
+	std::string getAddressStringFromPointer(const GeoTransform* pointer);
+	std::string getAddressStringFromPointer(const GeoNameTag* pointer);
+
+	std::string getQStringFromOss(std::ostringstream &oss);
 
 	std::vector<double> getTransformParameters(GeoTrf::Transform3D); // TODO: to be moved to Eigen (GeoTrf) and to be moved to an Utility class, so we can use it from TransFunctionRecorder as well.
   std::string getShapeParameters(const GeoShape*);
 
-	QString getGeoTypeFromVPhysVol(const GeoVPhysVol* vol);
+  std::string getGeoTypeFromVPhysVol(const GeoVPhysVol* vol);
 
-	QString getIdFromNodeType(QString nodeType);
+  unsigned int getIdFromNodeType(const std::string &nodeType);
 
-	QString m_dbpath;
+  std::string m_dbpath;
 	GMDBManager* m_dbManager;
 
-	QMap<QString, QVariant> m_memMap; // TODO: maybe move to QHash??
-	QHash<QString, unsigned int> m_memMap_Tables;
-	QMap<QString, unsigned int> m_parentChildrenMap2; // TODO: clean name!
-	QMap<QString, unsigned int> m_volumeCopiesMap;
+  std::unordered_map<std::string, unsigned int> m_parentChildrenMap;
+  std::unordered_map<std::string, unsigned int> m_volumeCopiesMap;
+  std::unordered_map<std::string, unsigned int> m_memMap;
+  std::unordered_map<std::string, unsigned int> m_memMap_Tables;
 
 	// keep track of the number of visited tree nodes
 	unsigned int m_len;
@@ -166,26 +161,21 @@ private:
 	bool m_rootVolumeFound;
 	bool m_unconnectedTree;
 
-	std::vector<QStringList> m_logVols;
-	std::vector<QStringList> m_physVols;
-	std::vector<QStringList> m_fullPhysVols;
-//  std::vector<QStringList> m_shapes;
-	std::vector<QStringList> m_materials;
-	std::vector<QStringList> m_elements;
-	std::vector<QStringList> m_transforms;
-	std::vector<QStringList> m_alignableTransforms;
-	std::vector<QStringList> m_serialDenominators;
-	std::vector<QStringList> m_serialTransformers;
-	std::vector<QStringList> m_functions;
-	std::vector<QStringList> m_nameTags;
-	std::vector<QStringList> m_childrenPositions;
-  
+  std::vector<std::vector<std::string>> m_logVols;
+	std::vector<std::vector<std::string>> m_physVols;
+	std::vector<std::vector<std::string>> m_fullPhysVols;
+	std::vector<std::vector<std::string>> m_materials;
+	std::vector<std::vector<std::string>> m_elements;
+	std::vector<std::vector<std::string>> m_transforms;
+	std::vector<std::vector<std::string>> m_alignableTransforms;
+	std::vector<std::vector<std::string>> m_serialDenominators;
+	std::vector<std::vector<std::string>> m_serialTransformers;
+	std::vector<std::vector<std::string>> m_functions;
+	std::vector<std::vector<std::string>> m_nameTags;
+	std::vector<std::vector<std::string>> m_childrenPositions;
   std::vector<std::vector<std::string>> m_shapes;
-	
-  QStringList m_rootVolume;
-  
+  std::vector<std::string> m_rootVolume;
 
-//  QStringList m_objectsNotPersistified;
   std::vector<std::string> m_objectsNotPersistified;
 
 };
diff --git a/GeoModelWrite/src/WriteGeoModel.cpp b/GeoModelWrite/src/WriteGeoModel.cpp
index 9defe19bb9b3c37c1556974754ea1bb2ad367561..cee0f70e45b79eed99a1c8cd97a009effd66a5e0 100644
--- a/GeoModelWrite/src/WriteGeoModel.cpp
+++ b/GeoModelWrite/src/WriteGeoModel.cpp
@@ -1,5 +1,8 @@
 // author: Riccardo.Maria.Bianchi@cern.ch, 2017
-// major updates: Aug 2018, Feb 2019
+// major updates:
+// - Aug 2018 - Riccardo Maria Bianchi
+// - Feb 2019 - Riccardo Maria Bianchi
+// - May 2020 - Riccardo Maria Bianchi
 
 // local includes
 #include "GeoModelWrite/WriteGeoModel.h"
@@ -34,14 +37,6 @@
 
 #include "GeoModelKernel/GeoUnidentifiedShape.h"
 
-// Qt includes
-#include <QSqlQuery>
-#include <QSqlError>
-#include <QSqlRecord>
-#include <QSqlDriver>
-#include <QVector>
-#include <QDebug>
-
 // C++ includes
 #include <sstream>
 
@@ -66,51 +61,48 @@ namespace GeoModelIO {
   }
   
 /// Get next child position available, given the parent type, id and copy number
-unsigned int WriteGeoModel::getChildPosition(const QString parentId, const QString parentType, const unsigned int copyN)
+  unsigned int WriteGeoModel::getChildPosition(const unsigned int &parentId, const std::string &parentType, const unsigned int &copyN)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::getChildPosition()";
-	QString tableId = getIdFromNodeType(parentType);
-	QString key = tableId + ":" + parentId + ":" + QString::number(copyN);
-
-	if ( ! (m_parentChildrenMap2.contains(key)) ) {
-		m_parentChildrenMap2[key] = 1;
+  unsigned int tableId = getIdFromNodeType(parentType);
+  std::string key = std::to_string(tableId) + ":" + std::to_string(parentId) + ":" + std::to_string(copyN);
+  
+  std::unordered_map<std::string, unsigned int>::iterator it = m_parentChildrenMap.find(key);
+	if ( it == m_parentChildrenMap.end() ) {
+		m_parentChildrenMap[key] = 1; // if item is not present, create an entry
 	} else {
-	    ++m_parentChildrenMap2[key];
+	    ++m_parentChildrenMap[key]; // if present already, then increment its entry
     }
-
-    //JFB Commented out: qDebug() << "parent key:" << key << " [tableId:parentId:copyN] - pos: " <<  m_parentChildrenMap2[key];
-	return m_parentChildrenMap2[key];
+	return m_parentChildrenMap[key];
 }
 
-unsigned int WriteGeoModel::setVolumeCopyNumber(QString volId, QString volType)
+  unsigned int WriteGeoModel::setVolumeCopyNumber(const unsigned int& volId, const std::string& volType)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::setVolumeCopyNumber()";
-	QString tableId = getIdFromNodeType(volType);
-	QString key = tableId + ":" + volId;
+	const unsigned int tableId = getIdFromNodeType(volType);
+  std::string key = std::to_string(tableId) + ":" + std::to_string(volId);
 
-	if ( ! (m_volumeCopiesMap.contains(key)) ) {
+  std::unordered_map<std::string, unsigned int>::iterator it = m_volumeCopiesMap.find(key);
+  if ( it == m_volumeCopiesMap.end() ) {
+//  if ( ! (m_volumeCopiesMap.contains(key)) ) {
 		m_volumeCopiesMap[key] = 1;
 	} else {
     	++m_volumeCopiesMap[key];
     }
-
-    //JFB Commented out: qDebug() << "volume key:" << key << " [tableId:volumeId] - copy number: " <<  m_volumeCopiesMap[key];
 	return m_volumeCopiesMap[key];
 }
 
 
-unsigned int WriteGeoModel::getLatestParentCopyNumber(QString parentId, QString parentType)
+  unsigned int WriteGeoModel::getLatestParentCopyNumber(const unsigned int &parentId, const std::string &parentType)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getLatestParentCopyNumber()";
-	QString tableId = getIdFromNodeType(parentType);
-	QString key = tableId + ":" + parentId;
-    //JFB Commented out: qDebug() << "key:" << key;
+  const unsigned int tableId = getIdFromNodeType(parentType);
+  std::string key = std::to_string(tableId) + ":" + std::to_string(parentId);
 
-	if ( ! (m_volumeCopiesMap.contains(key)) ) {
-		qFatal("ERROR!!! Something's wrong in storing the number of copies!");
+  std::unordered_map<std::string, unsigned int>::iterator it = m_volumeCopiesMap.find(key);
+  if ( it == m_volumeCopiesMap.end() ) {
+//  if ( ! (m_volumeCopiesMap.contains(key)) ) {
+    std::cout << "ERROR!!! Something's wrong in storing the number of copies!" << std::endl;
 	}
-
-    //JFB Commented out: qDebug() << "get latest parent copy number:" << key << " [tableId:parentId] - copy number: " <<  m_volumeCopiesMap[key];
 	return m_volumeCopiesMap[key];
 }
 
@@ -135,10 +127,10 @@ void WriteGeoModel::handleVPhysVolObjects(const GeoVPhysVol* vol)
 
 
 	// get the address string for the current volume
-	QString address = getAddressStringFromPointer( vol );
+  std::string address = getAddressStringFromPointer( vol );
 
 	// variables used to persistify the object
-	QVariant physId;
+	unsigned int physId;
 
 	// check the volume position in the geometry tree
 	GeoNodePath* path = getPath();
@@ -196,9 +188,9 @@ void WriteGeoModel::handleVPhysVolObjects(const GeoVPhysVol* vol)
 
 	// get the parent volume, if this is not the Root volume or an unconnected sub-tree
 	const GeoVPhysVol* parentNode = nullptr;
-	QVariant parentId = "NULL";
+	unsigned int parentId = 0;
 
-    QString volTypeStr = "NNN";
+  std::string volTypeStr = "0";
 
 	if (doGetParentNode) {
 
@@ -212,7 +204,7 @@ void WriteGeoModel::handleVPhysVolObjects(const GeoVPhysVol* vol)
         //JFB Commented out: qDebug() << "parentNode address" << parentNode;
 
 		if (parentNode) {
-			QString parentAddress = getAddressStringFromPointer(parentNode);
+      std::string parentAddress = getAddressStringFromPointer(parentNode);
 			//JFB Commented out: qDebug() << "==> parent's address:" << parentNode;
 
 			if (isAddressStored(parentAddress))
@@ -257,40 +249,30 @@ void WriteGeoModel::handleVPhysVolObjects(const GeoVPhysVol* vol)
 
 		// LOGVOL
 		const GeoLogVol* logVol = vol->getLogVol();
-		const QString logName = QString::fromStdString(logVol->getName());
-		//JFB Commented out: qDebug() << "LogVol name:"  << logName;
-
+    const std::string logName = logVol->getName();
 
 		// MATERIAL
 		const GeoMaterial * mat = vol->getLogVol()->getMaterial();
-		// const QString matName = QString::fromStdString(mat->getName());
-		// qDebug() << "material name:" << matName << ", address:" << mat;
-
 
 		// SHAPE
 		const GeoShape * shape = vol->getLogVol()->getShape();
-		// const QString shapeType = QString::fromStdString(shape->type());
-		// qDebug() << "shape name:" << shapeType  << ", address:" << shape;
-		// // get shape parameters
-		// QString shapePars = getShapeParameters(shape);
-
 
 		/*
 		 * STORE THE OBJECTS IN THE DB
 		 */
 
 		// store/get the Material object into/from the DB
-		QVariant matId;
+		unsigned int matId;
 		// matId = storeObj(mat, matName);
 		matId = storeMaterial(mat);
 
 		// store/get the Shape object into/from the DB
-		QVariant shapeId;
+		unsigned int shapeId;
 		shapeId = storeShape(shape);
 		// shapeId = storeObj(shape, shapeType, shapePars);
 
 		// store/get the LogVol object into/from the DB
-		QVariant logvolId;
+		unsigned int logvolId;
 		logvolId = storeObj(logVol, logName, shapeId, matId);
 
 		if (dynamic_cast<const GeoPhysVol*>(vol)) {
@@ -298,64 +280,58 @@ void WriteGeoModel::handleVPhysVolObjects(const GeoVPhysVol* vol)
 			const GeoPhysVol* physVol = dynamic_cast<const GeoPhysVol*>(vol);
 			// store the PhysVol volume into the DB
 			physId = storeObj(physVol, logvolId, parentId, storeRootVolume); // with parent info
-            volTypeStr = "GeoPhysVol";
+      volTypeStr = "GeoPhysVol";
 			//JFB Commented out: qDebug() << "PhysVol stored. Id:" << physId.toString();
 		}
 		else if (dynamic_cast<const GeoFullPhysVol*>(vol)) {
-			//JFB Commented out: qDebug() << "New FullPhysVol, storing it...";
 			const GeoFullPhysVol* fullVol = dynamic_cast<const GeoFullPhysVol*>(vol);
-			// store the FullPhysVol volume into the DB
 			physId = storeObj(fullVol, logvolId, parentId, storeRootVolume); // with parent info
-            volTypeStr = "GeoFullPhysVol";
-			//JFB Commented out: qDebug() << "FullPhysVol stored. Id:" << physId.toString();
+      volTypeStr = "GeoFullPhysVol";
 		} else {
-			qWarning() << "WARNING!! Unknown GeoVPhysVol type!!";
+      std::cout << "WARNING!! Unknown GeoVPhysVol type!! Exiting..." << std::endl;
+      exit(EXIT_FAILURE);
 		}
 
 	} else {
-		//	qDebug() << "Volume stored already. It is a shared volume. Taking ID from memory map and moving to its physical children...";
-		//JFB Commented out: qDebug() << "Volume stored already. It is a shared volume. Now, we are handling a 'copy' of it. We take the ID from memory map...";
 		physId = getStoredIdFromAddress(address);
-        volTypeStr = getGeoTypeFromVPhysVol(vol);
+    volTypeStr = getGeoTypeFromVPhysVol(vol);
 	}
 
     // Now we get the 'copy number' for this volume,
     // to distinguish this volume from the other volumes created from the same shared node (if any)
     if (volTypeStr == "NULL") qFatal("ERROR!! volTypeStr is 'NULL'!!!");
-    const unsigned int volCopyN = setVolumeCopyNumber(physId.toString(), volTypeStr);
+    const unsigned int volCopyN = setVolumeCopyNumber(physId, volTypeStr);
     //JFB Commented out: qDebug() << "physId: " << physId << "- volume copy number: " << volCopyN;
 
-    if ( isRootVolume || parentId == "NULL") {
+    if ( isRootVolume || parentId == 0) {
         //JFB Commented out: qDebug() << "This is the RootVolume or the volume has 'NULL' parent (unconnected subtree?) - So, we do not store the child position for this volume!";
     } else {
 	    // store the parent-child relationship in the DB
-	    QString parentType = getGeoTypeFromVPhysVol(parentNode);
+      std::string parentType = getGeoTypeFromVPhysVol(parentNode);
         // get the copy number of the parent
-        const unsigned int parentCopyN = getLatestParentCopyNumber(parentId.toString(), parentType);
+        const unsigned int parentCopyN = getLatestParentCopyNumber(parentId, parentType);
 	    //JFB Commented out: qDebug() << "PhysVol Id:" << physId << " - copyNumber:" << QString::number(parentCopyN);
 
-	    QString childType  = getGeoTypeFromVPhysVol(vol);
+      std::string childType  = getGeoTypeFromVPhysVol(vol);
 
-	    storeChildPosition(parentId, parentType, physId, parentCopyN, getChildPosition( parentId.toString(), parentType, parentCopyN), childType, volCopyN);
+	    storeChildPosition(parentId, parentType, physId, parentCopyN, getChildPosition( parentId, parentType, parentCopyN), childType, volCopyN);
     }
 }
 
 
-QString WriteGeoModel::getGeoTypeFromVPhysVol(const GeoVPhysVol* vol)
+  std::string WriteGeoModel::getGeoTypeFromVPhysVol(const GeoVPhysVol* vol)
 {
 	if (!vol)
-		return QString("NULL");
+		return "NULL";
 
-	QString geoType;
+  std::string geoType;
 	if (dynamic_cast<const GeoPhysVol*>(vol)) {
-		//JFB Commented out: qDebug() << "GeoType: GeoPhysVol";
 		geoType = "GeoPhysVol";
 	}
 	else if (dynamic_cast<const GeoFullPhysVol*>(vol)) {
-		//JFB Commented out: qDebug() << "GeoType: GeoFullPhysVol";
 		geoType = "GeoFullPhysVol";
 	} else {
-		qWarning() << "WARNING!! Unknown GeoVPhysVol type!!";
+    std::cout << "WARNING!! Unknown GeoVPhysVol type!!" << std::endl;
 	}
 	return geoType;
 }
@@ -363,35 +339,25 @@ QString WriteGeoModel::getGeoTypeFromVPhysVol(const GeoVPhysVol* vol)
 
 void WriteGeoModel::handleSerialDenominator (const GeoSerialDenominator *node)
 {
-	//JFB Commented out: qDebug() << "\nWriteGeoModel::handleSerialDenominator(GeoSerialDenominator*)";
-
-	QString address = getAddressStringFromPointer( node );
-
-	std::string baseNameStr = node->getBaseName();
-	QString baseName = QString::fromStdString(baseNameStr);
-	//JFB Commented out: qDebug() << "base name:" << baseName << "address:" << address;
+  std::string address = getAddressStringFromPointer( node );
+  std::string baseName = node->getBaseName();
 
 	// variables used to persistify the object
-	QVariant sdId;
+	unsigned int sdId;
 
 	// get the parent volume
-	QStringList parentList = getParentNode();
-	QString parentId = parentList[0];
-	QString parentType = parentList[1];
-	unsigned int parentCopyN = getLatestParentCopyNumber(parentId, parentType);
+  const std::vector<std::string> parentList = getParentNode();
+  const unsigned int parentId = std::stoi(parentList[0]);
+  const std::string parentType = parentList[1];
+	const unsigned int parentCopyN = getLatestParentCopyNumber(parentId, parentType);
 
 	// check if this object has been stored already
 	if (! isAddressStored(address)) {
-
-		//JFB Commented out: qDebug() << "New SerialDenominator, storing it...";
-
 		/* STORE THE OBJECT IN THE DB */
 		sdId = storeObj(node, baseName);
-		//JFB Commented out: qDebug() << "SerialDenominator stored. Id:" << sdId.toString();
-
 	} else {
+    /* GET THE OBJECT FROM THE DB */
 		sdId = getStoredIdFromAddress(address);
-		//JFB Commented out: qDebug() << "SerialDenominator already stored in the DB. Id:" << sdId.toString();
 	}
 
 	storeChildPosition(parentId, parentType, sdId, parentCopyN, getChildPosition( parentId, parentType, parentCopyN ), "GeoSerialDenominator", 0); // TODO: Check if the copyN=0 at the end is OK for nodes as Transforms, which cannot be used as parents, only as children!
@@ -403,27 +369,24 @@ void WriteGeoModel::handleSerialTransformer (const GeoSerialTransformer *node)
 {
 	//JFB Commented out: qDebug() << "\nWriteGeoModel::handleSerialTransformer(GeoSerialTransformer*)";
 
-	QString address = getAddressStringFromPointer( node );
+  std::string address = getAddressStringFromPointer( node );
 
 	// variables used to persistify the object
-	QVariant functionId;
-	QVariant physvolId;
-	QVariant physvolTable;
+	unsigned int functionId;
+	unsigned int physvolId;
+//  unsigned int physvolTable;
 	unsigned int nCopies;
-	QVariant stId;
+	unsigned int stId;
 
 	// get the parent volume
-	QStringList parentList = getParentNode();
-	QString parentId = parentList[0];
-	QString parentType = parentList[1];
+  const std::vector<std::string> parentList = getParentNode();
+  const unsigned int parentId = std::stoi(parentList[0]);
+  const std::string parentType = parentList[1];
 	unsigned int parentCopyN = getLatestParentCopyNumber(parentId, parentType);
 
 
 	// check if this object has been stored already
 	if (! isAddressStored(address)) {
-
-		//JFB Commented out: qDebug() << "New SerialTransformer, storing it...";
-
 		/*
 		 * Get Node characteristics
 		 *
@@ -437,18 +400,17 @@ void WriteGeoModel::handleSerialTransformer (const GeoSerialTransformer *node)
 		// get linked function and number of copies
 		const GeoXF::Function * func = node->getFunction();
 		nCopies =  node->getNCopies();
-		//JFB Commented out: qDebug() << "n. of copies:" << QString::number(nCopies);
 
 		// get linked VPhysVol volume
 		const GeoVPhysVol *vol = &( *( node->getVolume() ) );
 		// const GeoPhysVol* vol = dynamic_cast<const GeoPhysVol*>(volV);
-		QString volType;
+    std::string volType;
 		if (dynamic_cast<const GeoPhysVol*>(vol)) {
 			volType = "GeoPhysVol";
 		} else if (dynamic_cast<const GeoFullPhysVol*>(vol)) {
 			volType = "GeoFullPhysVol";
 		} else {
-			qWarning() << "ERROR!!! Unknown VPhysVol type!!";
+      std::cout << "ERROR!!! Unknown VPhysVol type!!" << std::endl;
 		}
 
 		/*
@@ -460,8 +422,7 @@ void WriteGeoModel::handleSerialTransformer (const GeoSerialTransformer *node)
         } catch (const std::runtime_error & error) {
             std::cout << "SEVERE WARNING!! Handling std::runtime_error! -->" << error.what() << std::endl;
         }
-		QString expression = QString::fromStdString( persistifier.getCodedString() );
-		//JFB Commented out: qDebug() << "FUNCTION:" << expression;
+    std::string expression = persistifier.getCodedString();
 
 		if (expression.size() == 0) {
 				qFatal("FATAL ERROR!! Function expression is empty!! Aborting...");
@@ -491,7 +452,7 @@ void WriteGeoModel::handleSerialTransformer (const GeoSerialTransformer *node)
 		handleReferencedVPhysVol(vol);
 
 		//JFB Commented out: qDebug() << "Storing the referenced VPhysVol...";
-		QString physvolAddress = getAddressStringFromPointer(vol);
+    std::string physvolAddress = getAddressStringFromPointer(vol);
 		physvolId = getStoredIdFromAddress(physvolAddress);
 
 
@@ -518,12 +479,12 @@ void WriteGeoModel::handleTransform(const GeoTransform* node)
 {
 	//JFB Commented out: qDebug() << "\nWriteGeoModel::handleTransform(GeoTransform*)";
 
-	QString address = getAddressStringFromPointer( node );
+  std::string address = getAddressStringFromPointer( node );
 
 	// get the parent volume
-	QStringList parentList = getParentNode();
-	QString parentId = parentList[0];
-	QString parentType = parentList[1];
+  const std::vector<std::string> parentList = getParentNode();
+  const unsigned int parentId = std::stoi(parentList[0]);
+  const std::string parentType = parentList[1];
 
 	unsigned int parentCopyN = getLatestParentCopyNumber(parentId, parentType);
 
@@ -532,7 +493,7 @@ void WriteGeoModel::handleTransform(const GeoTransform* node)
 	 */
 
 	 // store the transformation in the DB
-	 QVariant trId = storeTranform(node);
+	 unsigned int trId = storeTranform(node);
 
 	// Store the child-parent relationship
 
@@ -545,7 +506,8 @@ void WriteGeoModel::handleTransform(const GeoTransform* node)
 		storeChildPosition(parentId, parentType, trId, parentCopyN, getChildPosition( parentId, parentType, parentCopyN ), "GeoTransform", 0); // TODO: Check if the copyN=0 at the end is OK for nodes as Transforms, which cannot be used as parents, only as children!
 	}
 	else {
-		qWarning("Not implemented yet!!!! ");
+    std::cout << "ERROR!! Unknwon Transform type! Exiting..." << std::endl;
+    exit(EXIT_FAILURE);
 	}
 
 }
@@ -553,28 +515,22 @@ void WriteGeoModel::handleTransform(const GeoTransform* node)
 
 void WriteGeoModel::handleNameTag(const GeoNameTag* node)
 {
-	//JFB Commented out: qDebug() << "\nWriteGeoModel::handleNameTag(GeoNameTag*)";
-
-	std::string nameStr = node->getName();
-	QString name = QString::fromStdString(nameStr);
-	//JFB Commented out: qDebug() << "name:" << name;
-
-	QString address = getAddressStringFromPointer( node );
-
+  std::string name = node->getName();
+  const std::string address = getAddressStringFromPointer( node );
 	// get the parent volume
-	QStringList parentList = getParentNode();
-	QString parentId = parentList[0];
-	QString parentType = parentList[1];
-    unsigned int parentCopyN = getLatestParentCopyNumber(parentId, parentType);
+  const std::vector<std::string> parentList = getParentNode();
+  const unsigned int parentId = std::stoi(parentList[0]);
+  const std::string parentType = parentList[1];
+  unsigned int parentCopyN = getLatestParentCopyNumber(parentId, parentType);
 
-    // TODO: add "if stored"...
+  // FIXME: TODO: add "if stored"...
 
 	/*
 	 * STORE THE OBJECT IN THE DB AND ITS POSITION WITHIN THE TREE
 	 */
 
 	 // store the name tag in the DB
-	 QVariant nameId = storeObj(node, name);
+	 unsigned int nameId = storeObj(node, name);
 
 	 // Store the child-parent relationship
 	 storeChildPosition(parentId, parentType, nameId, parentCopyN, getChildPosition( parentId, parentType, parentCopyN ), "GeoNameTag", 0);
@@ -583,14 +539,11 @@ void WriteGeoModel::handleNameTag(const GeoNameTag* node)
 
 
 //__________________________________________________
-QStringList WriteGeoModel::getParentNode()
+  std::vector<std::string> WriteGeoModel::getParentNode()
 {
-    //JFB Commented out: qDebug() << "WriteGeoModel::getParentNode()";
-
 	// check the current volume position in the geometry tree
 	GeoNodePath* path = getPath();
 	unsigned int len = path->getLength();
-	//JFB Commented out: qDebug() << "length: " << len;
 
 	// reset the number of visited node, if len is different than before
 	if (len > m_len) {
@@ -604,8 +557,8 @@ QStringList WriteGeoModel::getParentNode()
 
 	// get the parent volume, if this is not the Root volume
 	const GeoVPhysVol* parentNode = nullptr;
-	QVariant parentId = "NULL";
-	QString parentType = "NULL";
+	unsigned int parentId = 0;
+  std::string parentType = "NULL";
 
 		if (len >= 1)
 		{
@@ -618,8 +571,7 @@ QStringList WriteGeoModel::getParentNode()
 				parentType = getGeoTypeFromVPhysVol(parentNode);
 
 				// get the parent memory address
-				QString parentAddress = getAddressStringFromPointer(parentNode);
-				//JFB Commented out: qDebug() << "-- parent's address:" << parentNode;
+        std::string parentAddress = getAddressStringFromPointer(parentNode);
 
 				// get the id of the parent node, which should be stored already in the DB
 				if (isAddressStored(parentAddress)) {
@@ -627,25 +579,24 @@ QStringList WriteGeoModel::getParentNode()
 				}
 				else {
 					// qFatal("FATAL ERROR!!! - The parent node of this child should has been stored in the DB already, but it was not found!!");
-					qWarning() << "The parent node of this child node seems to not having be stored in the DB yet! [It is normal if it is the root volume or a transformation node used for example only in the definition of a 'GeoShapeShift' instance]";
+          std::cout << "The parent node of this child node seems to not having be stored in the DB yet! [It is normal if it is the root volume or a transformation node used for example only in the definition of a 'GeoShapeShift' instance]" << std::endl;
 				}
-				//JFB Commented out: qDebug() << "-- parent's LogVol name:" << QString::fromStdString(parentNode->getLogVol()->getName());
 			}
 		}
 		else{
 			// qWarning() << "ERROR!! Len == 1, but this cannot be the Root volume!";
-			qWarning() << "WARNING!! Len == 0, but this cannot be the Root volume!";
+      std::cout << "WARNING!! Len == 0, but this cannot be the Root volume!" << std::endl;
 		}
 
-		QStringList parentList;
-		parentList << parentId.toString() << parentType;
+  std::vector<std::string> parentList;
+  parentList.insert(parentList.begin(), {std::to_string(parentId), parentType});
 
 		return  parentList;
 }
 
 
 //__________________________________________________________________
-QVariant WriteGeoModel::storeShape(const GeoShape* shape)
+unsigned int WriteGeoModel::storeShape(const GeoShape* shape)
 {
 //  QString shapeType = QString::fromStdString(shape->type());
   std::string shapeType = shape->type();
@@ -666,14 +617,14 @@ QVariant WriteGeoModel::storeShape(const GeoShape* shape)
 
 
 //______________________________________________________________________
-QVariant WriteGeoModel::storeMaterial(const GeoMaterial* mat)
+unsigned int WriteGeoModel::storeMaterial(const GeoMaterial* mat)
 {
-	const QString matName = QString::fromStdString(mat->getName());   //The name of the material.
-	const QString matID = QString::number(mat->getID());              //Gives an integral identifier for the material.For convenience.
-	const QString matDensity = QString::number(mat->getDensity());	  //The density of the material.
+  const std::string matName = mat->getName();   //The name of the material.
+	const double matDensity = mat->getDensity();	  //The density of the material.
 	const unsigned int numElements = mat->getNumElements();
 
-	const QString matNumElements = QString::number(numElements);
+//  const QString matID = QString::number(mat->getID());              //Gives an integral identifier for the material.For convenience.
+//  const QString matNumElements = QString::number(numElements);
 	//JFB Commented out: qDebug() << "storeMaterial() - material name:" << matName
 	//		<< ", address:" << mat
 	//		<< ", matID:" << matID
@@ -681,30 +632,23 @@ QVariant WriteGeoModel::storeMaterial(const GeoMaterial* mat)
 	//		<< ", matNumElements:" << matNumElements;
 
 	// loop over the elements composing the material
-	QString matElements;
-	QStringList matElementsList;
+  std::string matElements;
+  std::vector<std::string> matElementsList;
 	for (unsigned int i=0; i < numElements; i++) {
 
 		//Gets the i-th element.
 		const GeoElement* element = mat->getElement(i);
 		std::string elName = element->getName();
-		/*
-		  std::cout << "\t element n. " << i << std::endl;
-		  std::cout << "\t element address: " << element << std::endl;
-		  std::cout << "\t element name: " << elName << std::endl;
-		 */
 
 		// Store the element and get its DataBase ID
-		QVariant elementId = storeElement(element);
+		unsigned int elementId = storeElement(element);
 
 		//Gets the fraction by weight of the i-th element
-		const QString elementFraction = QString::number( mat->getFraction(i) );
+    const std::string elementFraction = std::to_string( mat->getFraction(i) );
 
-		//JFB Commented out: qDebug() << "\t--> element ID: " << elementId.toString() << " - getFraction:" << elementFraction;
-
-		matElementsList << elementId.toString() + ":" + elementFraction;
+    matElementsList.push_back( std::to_string(elementId) + ":" + elementFraction );
 	}
-	matElements = matElementsList.join(";");
+	matElements = joinVectorStrings(matElementsList, ";");
 
 	//JFB Commented out: qDebug() << "\t==> material's elements:" << matElements;
 
@@ -714,19 +658,19 @@ QVariant WriteGeoModel::storeMaterial(const GeoMaterial* mat)
 
 
 //_______________________________________________________________________
-QVariant WriteGeoModel::storeElement(const GeoElement* el)
+unsigned int WriteGeoModel::storeElement(const GeoElement* el)
 {
 	//	The name of the element, e.g. "Carbon".
-	const QString elName = QString::fromStdString(el->getName());
+  const std::string elName = el->getName();
 
 	//	The chemical symbol for the element, e.g. C, O, S, Na....
-	const QString elSymbol = QString::fromStdString(el->getSymbol());
+  const std::string elSymbol = el->getSymbol();
 
 	//	The atomic number Z for the material.
-	const QString elZ = QString::number(el->getZ());
+  const double elZ = el->getZ();
 
 	//	The average atomic mass for the element.
-	const QString elA = QString::number(el->getA());
+  const double elA = el->getA();
 
 	// store the material in the DB and returns the ID
 	return storeObj(el, elName, elSymbol, elZ, elA);
@@ -734,15 +678,15 @@ QVariant WriteGeoModel::storeElement(const GeoElement* el)
 
 
 //_______________________________________________________________________
-QVariant WriteGeoModel::storeTranform(const GeoTransform* node)
+unsigned int WriteGeoModel::storeTranform(const GeoTransform* node)
 {
 	/*
 	 * STORE THE OBJECT IN THE DB
 	 */
 
-	 QString address = getAddressStringFromPointer( node );
+  std::string address = getAddressStringFromPointer( node );
 
-	 QVariant trId;
+	 unsigned int trId = 0;
 
 	// check if this object has been stored already
 	if (! isAddressStored(address)) {
@@ -818,14 +762,17 @@ QVariant WriteGeoModel::storeTranform(const GeoTransform* node)
 			//JFB Commented out: qDebug() << "Transform stored. Id:" << trId.toString();
 		}
 		else {
-			std::cout << "WARNING!!! - This type of transformation still needs to be persistified!!" << std::endl;
+			std::cout << "ERROR!!! - Unknown type of transformation! Exiting..." << std::endl;
+      exit(EXIT_FAILURE);
 		}
-
 	} else {
 		trId = getStoredIdFromAddress(address);
-		//JFB Commented out: qDebug() << "Transform already stored in the DB. Id:" << trId.toString();
 	}
-
+  
+  if(!trId) {
+    std::cout << "ERROR!!! - Error while handling a Transform node! Exiting..." << std::endl;
+    exit(EXIT_FAILURE);
+  }
 	return trId;
 }
 
@@ -837,9 +784,9 @@ void WriteGeoModel::handleReferencedVPhysVol (const GeoVPhysVol *vol)
 	// qDebug() << "PhysVol's LogVol name:" << QString::fromStdString(vol->getLogVol()->getName());
 
 	// get the address string for the current volume
-	QString address = getAddressStringFromPointer( vol );
+  std::string address = getAddressStringFromPointer( vol );
 
-	QVariant parentId = "NULL";
+	unsigned int parentId = 0;
 
 	//JFB Commented out: qDebug() << "setting 'unconnected' to: false";
 	m_unconnectedTree = false;
@@ -852,8 +799,7 @@ void WriteGeoModel::handleReferencedVPhysVol (const GeoVPhysVol *vol)
 	const GeoVPhysVol* parentNode = p ? dynamic_cast<const GeoVPhysVol*>( &(*(vol->getParent() ))) : nullptr;
 	
 	if (parentNode) {
-		QString parentAddress = getAddressStringFromPointer(parentNode);
-		//JFB Commented out: qDebug() << "--> parent's address:" << parentNode;
+    std::string parentAddress = getAddressStringFromPointer(parentNode);
 
 		if (isAddressStored(parentAddress))
 			parentId = getStoredIdFromAddress(parentAddress);
@@ -1053,47 +999,47 @@ std::string WriteGeoModel::getShapeParameters(const GeoShape* shape)
 		const GeoShapeIntersection* shapeIn = dynamic_cast<const GeoShapeIntersection*>(shape);
 		// get the referenced Shape used in the 'union' operation, store it in the DB
 		const GeoShape* shapeOpA = shapeIn->getOpA();
-		QVariant shapeIdA = storeShape(shapeOpA);
+		const unsigned int shapeIdA = storeShape(shapeOpA);
 		const GeoShape* shapeOpB = shapeIn->getOpB();
-		QVariant shapeIdB = storeShape(shapeOpB);
-		pars.push_back("opA=" + std::to_string( shapeIdA.toUInt() )) ;
-		pars.push_back("opB=" + std::to_string( shapeIdB.toUInt() )) ;
+		const unsigned int shapeIdB = storeShape(shapeOpB);
+		pars.push_back("opA=" + std::to_string( shapeIdA )) ;
+		pars.push_back("opB=" + std::to_string( shapeIdB )) ;
 	}
 	else if (shapeType == "Shift") {
 		const GeoShapeShift* shapeIn = dynamic_cast<const GeoShapeShift*>(shape);
 
 		// get the referenced Shape used in the 'shift' operation, store it in the DB
 		const GeoShape* shapeOp = shapeIn->getOp();
-		QVariant shapeId = storeShape(shapeOp);
+		const unsigned int shapeId = storeShape(shapeOp);
 
 		// get the Transformation, store it in the DB
 		GeoTransform* transf = new GeoTransform( shapeIn->getX() );
-		QVariant trId = storeTranform(transf);
+		const unsigned int trId = storeTranform(transf);
 
-		pars.push_back("A=" + std::to_string( shapeId.toUInt() )) ;
-		pars.push_back("X=" + std::to_string( trId.toUInt() )) ;
+		pars.push_back("A=" + std::to_string( shapeId ));
+		pars.push_back("X=" + std::to_string( trId ));
 	}
 	else if (shapeType == "Subtraction") {
 		const GeoShapeSubtraction* shapeIn = dynamic_cast<const GeoShapeSubtraction*>(shape);
 		// get the referenced Shape used in the 'union' operation, store it in the DB
 		const GeoShape* shapeOpA = shapeIn->getOpA();
-		QVariant shapeIdA = storeShape(shapeOpA);
+		const unsigned int shapeIdA = storeShape(shapeOpA);
 		const GeoShape* shapeOpB = shapeIn->getOpB();
-		QVariant shapeIdB = storeShape(shapeOpB);
-		pars.push_back("opA=" + std::to_string( shapeIdA.toUInt() )) ;
-		pars.push_back("opB=" + std::to_string( shapeIdB.toUInt() )) ;
+		const unsigned int shapeIdB = storeShape(shapeOpB);
+		pars.push_back("opA=" + std::to_string( shapeIdA ));
+		pars.push_back("opB=" + std::to_string( shapeIdB ));
 	}
 	else if (shapeType == "Union") {
 		const GeoShapeUnion* shapeIn = dynamic_cast<const GeoShapeUnion*>(shape);
 
 		// get the referenced Shape used in the 'union' operation, store it in the DB
 		const GeoShape* shapeOpA = shapeIn->getOpA();
-		QVariant shapeIdA = storeShape(shapeOpA);
+		unsigned int shapeIdA = storeShape(shapeOpA);
 		const GeoShape* shapeOpB = shapeIn->getOpB();
-		QVariant shapeIdB = storeShape(shapeOpB);
+		unsigned int shapeIdB = storeShape(shapeOpB);
 
-		pars.push_back("opA=" + std::to_string( shapeIdA.toUInt() )) ;
-		pars.push_back("opB=" + std::to_string( shapeIdB.toUInt() )) ;
+		pars.push_back("opA=" + std::to_string( shapeIdA )) ;
+		pars.push_back("opB=" + std::to_string( shapeIdB )) ;
 	}
 	else if (shapeType=="GenericTrap") {
 	  const GeoGenericTrap * shapeIn = dynamic_cast<const GeoGenericTrap*>(shape);
@@ -1194,21 +1140,21 @@ void WriteGeoModel::showMemoryMap()
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::showMemoryMap()";
 
-	QMap<QString, QVariant>::const_iterator it = m_memMap.constBegin();
-	while (it != m_memMap.constEnd()) {
-		std::cout << it.key().toStdString() << ": " << it.value().toString().toStdString() << std::endl;
+  std::unordered_map<std::string, unsigned int>::const_iterator it = m_memMap.begin();
+	while (it != m_memMap.end()) {
+		std::cout << it->first << ": " << it->second << std::endl;
 		++it;
 	}
 }
 
 
 
-QVariant WriteGeoModel::storeObj(const GeoMaterial* pointer, const QString name, const QString density, const QString elements)
+  unsigned int WriteGeoModel::storeObj(const GeoMaterial* pointer, const std::string &name, const double &density, const std::string &elements)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoMaterial*) - name:" << name << "- address:" << pointer << "- density:" << density << "- elements:" << elements;
 
-	QString address = getAddressStringFromPointer( pointer );
-	QVariant materialId;
+  std::string address = getAddressStringFromPointer( pointer );
+	unsigned int materialId;
 
 	if (! isAddressStored(address)) {
 		//JFB Commented out: qDebug() << "New Material! Storing it...";
@@ -1226,17 +1172,15 @@ QVariant WriteGeoModel::storeObj(const GeoMaterial* pointer, const QString name,
 }
 
 
-QVariant WriteGeoModel::storeObj(const GeoElement* pointer, const QString name, const QString symbol, const QString elZ, const QString elA)
+  unsigned int WriteGeoModel::storeObj(const GeoElement* pointer, const std::string &name, const std::string &symbol, const double &elZ, const double &elA)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoElement*) - name:" << name << "address:" << pointer << " - symbol: " << symbol << " - elZ: " << elZ << " - elA: " << elA;
-
-	QString address = getAddressStringFromPointer( pointer );
-	QVariant elementId;
+  std::string address = getAddressStringFromPointer( pointer );
+	unsigned int elementId;
 
 	if (! isAddressStored(address)) {
 		//JFB Commented out: qDebug() << "New Element! Storing it...";
 
-		elementId = addElement(name, symbol, elZ, elA);
+    elementId = addElement(name, symbol, elZ, elA);
 
 		storeAddress( address, elementId );
 	}
@@ -1249,11 +1193,11 @@ QVariant WriteGeoModel::storeObj(const GeoElement* pointer, const QString name,
 }
 
 
-  QVariant WriteGeoModel::storeObj(const GeoShape* pointer, const std::string name, const std::string parameters)
+  unsigned int WriteGeoModel::storeObj(const GeoShape* pointer, const std::string &name, const std::string &parameters)
 {
-	QString address = getAddressStringFromPointer( pointer );
+  std::string address = getAddressStringFromPointer( pointer );
 
-	QVariant shapeId;
+	unsigned int shapeId;
 	if (! isAddressStored(address)) {
 		//JFB Commented out: qDebug() << "New Shape! Storing it...";
 
@@ -1270,221 +1214,178 @@ QVariant WriteGeoModel::storeObj(const GeoElement* pointer, const QString name,
 	return shapeId;
 }
 
-QVariant WriteGeoModel::storeObj(const GeoLogVol* pointer, const QString name, const QVariant shapeId, const QVariant materialId)
+unsigned int WriteGeoModel::storeObj(const GeoLogVol* pointer, const std::string &name, const unsigned int &shapeId, const unsigned int &materialId)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoLogVol*) - name:" << name << "address:" << pointer;
 
-	QString address = getAddressStringFromPointer( pointer );
+  std::string address = getAddressStringFromPointer( pointer );
 
-	QVariant logvolId;
+	unsigned int logvolId;
 	if (! isAddressStored(address)) {
-		//JFB Commented out: qDebug() << "New LogVol! Storing it...";
-
-		// logvolId = m_dbManager->addLogVol(name, shapeId, materialId);
 		logvolId = addLogVol(name, shapeId, materialId);
-
 		storeAddress( address, logvolId );
 	}
 	else {
-		//JFB Commented out: qDebug() << "LogVol node stored already. Getting ID from the memory map...";
 		logvolId = getStoredIdFromAddress(address);
 	}
-	//JFB Commented out: qDebug() << "logvolId:" << logvolId;
 	return logvolId;
 }
 
 
-QVariant WriteGeoModel::storeObj(const GeoPhysVol* pointer, const QVariant logvolId, const QVariant parentId, bool isRootVolume)
+unsigned int WriteGeoModel::storeObj(const GeoPhysVol* pointer, const unsigned int &logvolId, const unsigned int parentId, const bool isRootVolume)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoPhysVol*) - address:" << pointer << "- is root volume?" << isRootVolume;
 
-	QString address = getAddressStringFromPointer( pointer );
+  std::string address = getAddressStringFromPointer( pointer );
 
-	QVariant physvolId;
+	unsigned int physvolId;
 	if (! isAddressStored(address)) {
-		//JFB Commented out: qDebug() << "New PhysVol! Storing it...";
-
-		// physvolId = m_dbManager->addPhysVol(logvolId, parentId, isRootVolume);
-		physvolId = addPhysVol(logvolId, parentId, isRootVolume);
-
+    physvolId = addPhysVol(logvolId, parentId, isRootVolume); // FIXME: remove parentInfo
+    
 		storeAddress( address, physvolId );
 	}
 	else {
-		//JFB Commented out: qDebug() << "PhysVol node stored already. Getting ID from the memory map...";
 		physvolId = getStoredIdFromAddress(address);
 	}
-	//JFB Commented out: qDebug() << "physvolId:" << physvolId;
 	return physvolId;
 }
 
-QVariant WriteGeoModel::storeObj(const GeoFullPhysVol* pointer, const QVariant logvolId, const QVariant parentId, bool isRootVolume)
+unsigned int WriteGeoModel::storeObj(const GeoFullPhysVol* pointer, const unsigned int &logvolId, const unsigned int parentId, const bool isRootVolume)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoFullPhysVol*) - address:" << pointer << "- is root volume?" << isRootVolume;
-
-	QString address = getAddressStringFromPointer( pointer );
+  std::string address = getAddressStringFromPointer( pointer );
 
-	QVariant physvolId;
+	unsigned int physvolId;
 	if (! isAddressStored(address)) {
-		//JFB Commented out: qDebug() << "New FullPhysVol! Storing it...";
-
-		// physvolId = m_dbManager->addFullPhysVol(logvolId, parentId, isRootVolume);
-		physvolId = addFullPhysVol(logvolId, parentId, isRootVolume);
+    physvolId = addFullPhysVol(logvolId, parentId, isRootVolume); // FIXME: remove parent info!
 
 		storeAddress( address, physvolId );
 	}
 	else {
-		//JFB Commented out: qDebug() << "FullPhysVol node stored already. Getting ID from the memory map...";
 		physvolId = getStoredIdFromAddress(address);
 	}
-	//JFB Commented out: qDebug() << "fullphysvolId:" << physvolId;
 	return physvolId;
 }
 
-QVariant WriteGeoModel::storeObj(const GeoSerialDenominator* pointer, const QString baseName)
+  unsigned int WriteGeoModel::storeObj(const GeoSerialDenominator* pointer, const std::string &baseName)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoSerialDenominator*) - baseName:" << baseName << "address:" << pointer;
-
-	QString address = getAddressStringFromPointer( pointer );
-	QVariant id;
+  const std::string address = getAddressStringFromPointer( pointer );
+	unsigned int id;
 
 	if (! isAddressStored(address)) {
-		//JFB Commented out: qDebug() << "New SerialDenominator! Storing it...";
-
 		// id = m_dbManager->addSerialDenominator(baseName);
 		id = addSerialDenominator(baseName);
 
 		storeAddress( address, id );
 	}
 	else {
-		//JFB Commented out: qDebug() << "SerialDenominator node stored already. Getting ID from the memory map...";
 		id = getStoredIdFromAddress(address);
 	}
-	//JFB Commented out: qDebug() << "ID:" << id;
 	return id;
 }
 
 
-QVariant WriteGeoModel::storeObj(const GeoSerialTransformer* pointer, const QVariant functionId, const QVariant volId, const QString volType, const unsigned int copies)
+  unsigned int WriteGeoModel::storeObj(const GeoSerialTransformer* pointer, const unsigned int &functionId, const unsigned int &volId, const std::string &volType, const unsigned int &copies)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoSerialTransformer*):" << volId.toUInt() << volType << "- n. of copies: " << copies;
-
-	QString address = getAddressStringFromPointer( pointer );
-	QVariant id;
+  const std::string address = getAddressStringFromPointer( pointer );
+	unsigned int id = 0;
 
 	if (! isAddressStored(address)) {
-		//JFB Commented out: qDebug() << "New SerialTransformer! Storing it...";
-
-		// id = m_dbManager->addSerialTransformer(functionId, volId, volType, copies);
 		id = addSerialTransformer(functionId, volId, volType, copies);
 
 		storeAddress( address, id );
 	}
 	else {
-		//JFB Commented out: qDebug() << "SerialTransformer node stored already. Getting ID from the memory map...";
 		id = getStoredIdFromAddress(address);
 	}
-	//JFB Commented out: qDebug() << "ID:" << id;
+  
+  if (!id) {
+    std::cout << "ERROR while storing a GeoSerialTransformer! Exiting..." << std::endl;
+    exit(EXIT_FAILURE);
+  }
 	return id;
 }
 
-QVariant WriteGeoModel::storeObj(const GeoXF::Function* pointer, const QString expression)
+  unsigned int WriteGeoModel::storeObj(const GeoXF::Function* pointer, const std::string &expression)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoXF::Function*)";
-
-	QString address = getAddressStringFromPointer( pointer );
-	QVariant id;
+  const std::string address = getAddressStringFromPointer( pointer );
+	unsigned int id = 0;
 
 	if (! isAddressStored(address)) {
-		//JFB Commented out: qDebug() << "New GeoXF::Function! Storing it...";
-
-		// id = m_dbManager->addFunction(expression);
 		id = addFunction(expression);
 
 		storeAddress( address, id );
 	}
 	else {
-		//JFB Commented out: qDebug() << "GeoXF::Function node stored already. Getting ID from the memory map...";
 		id = getStoredIdFromAddress(address);
 	}
-	//JFB Commented out: qDebug() << "ID:" << id;
+  
+  if (!id) {
+    std::cout << "ERROR while storing a Function! Exiting..." << std::endl;
+    exit(EXIT_FAILURE);
+  }
 	return id;
 }
 
-QVariant WriteGeoModel::storeObj(const GeoTransform* pointer, std::vector<double> parameters)
+unsigned int WriteGeoModel::storeObj(const GeoTransform* pointer, const std::vector<double> &parameters)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoTransform*)";
-
-
-	QString address = getAddressStringFromPointer( pointer );
-	QVariant id;
+  const std::string address = getAddressStringFromPointer( pointer );
+	unsigned int id = 0;
 
 	if (! isAddressStored(address)) {
-		//JFB Commented out: qDebug() << "New GeoXF::Function! Storing it...";
-
-		// id = m_dbManager->addTransform( QVector<double>::fromStdVector(parameters) );
 		id = addTransform( parameters );
-
 		storeAddress( address, id );
 	}
 	else {
-		//JFB Commented out: qDebug() << "GeoTransform node stored already. Getting ID from the memory map...";
 		id = getStoredIdFromAddress(address);
 	}
-	//JFB Commented out: qDebug() << "ID:" << id;
+  if (!id) {
+    std::cout << "ERROR while storing a GeoTransform! Exiting..." << std::endl;
+    exit(EXIT_FAILURE);
+  }
 	return id;
 }
 
-QVariant WriteGeoModel::storeObj(const GeoAlignableTransform* pointer, std::vector<double> parameters)
+unsigned int WriteGeoModel::storeObj(const GeoAlignableTransform* pointer, const std::vector<double> &parameters)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoAlignableTransform*)";
-
-
-	QString address = getAddressStringFromPointer( pointer );
-	QVariant id;
+  const std::string address = getAddressStringFromPointer( pointer );
+	unsigned int id = 0;
 
 	if (! isAddressStored(address)) {
-		//JFB Commented out: qDebug() << "New GeoXF::Function! Storing it...";
-
-		// id = m_dbManager->addAlignableTransform( QVector<double>::fromStdVector(parameters) );
 		id = addAlignableTransform( parameters );
-
 		storeAddress( address, id );
 	}
 	else {
-		//JFB Commented out: qDebug() << "GeoAlignableTransform node stored already. Getting ID from the memory map...";
 		id = getStoredIdFromAddress(address);
 	}
-	//JFB Commented out: qDebug() << "ID:" << id;
+  if (!id) {
+    std::cout << "ERROR while storing a GeoAlignableTransform! Exiting..." << std::endl;
+    exit(EXIT_FAILURE);
+  }
 	return id;
 }
 
 
-QVariant WriteGeoModel::storeObj(const GeoNameTag* pointer, const QString name)
+  unsigned int WriteGeoModel::storeObj(const GeoNameTag* pointer, const std::string &name)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeObj(GeoNameTag*) - name:" << name << "address:" << pointer;
-
-	QString address = getAddressStringFromPointer( pointer );
-	QVariant id;
+  const std::string address = getAddressStringFromPointer( pointer );
+	unsigned int id = 0;
 
 	if (! isAddressStored(address)) {
-		//JFB Commented out: qDebug() << "New SerialDenominator! Storing it...";
-
-		// id = m_dbManager->addNameTag(name);
 		id = addNameTag(name);
-
 		storeAddress( address, id );
 	}
 	else {
-		//JFB Commented out: qDebug() << "SerialDenominator node stored already. Getting ID from the memory map...";
 		id = getStoredIdFromAddress(address);
 	}
-	//JFB Commented out: qDebug() << "ID:" << id;
+  if (!id) {
+    std::cout << "ERROR while storing a GeoNameTag! Exiting..." << std::endl;
+    exit(EXIT_FAILURE);
+  }
 	return id;
 }
 
-void WriteGeoModel::storeChildPosition(const QVariant parentId, const QString parentType, const QVariant childId, const unsigned int parentCopyN, const unsigned int childPos, const QString childType, const unsigned int childCopyN)
+  void WriteGeoModel::storeChildPosition(const unsigned int &parentId, const std::string &parentType, const unsigned int &childId, const unsigned int &parentCopyN, const unsigned int &childPos, const std::string &childType, const unsigned int &childCopyN)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeChildPosition()";
 	addChildPosition(parentId, parentType, childId, parentCopyN, childPos, childType, childCopyN); // FIXME: change the positions of the parameters to a more logical order, like: parentID, parentType, parentCopyN, childPos, ChildType, childId, childCopyN
 	return;
 }
@@ -1498,169 +1399,153 @@ void WriteGeoModel::storeChildPosition(const QVariant parentId, const QString pa
 	return idx;
 }
 
-QVariant WriteGeoModel::addMaterial(const QString name, const QString density, const QString elements)
+  unsigned int WriteGeoModel::addMaterial(const std::string &name, const double &density, const std::string &elements)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::addMaterial(QString*) - name:" << name << "- density:" << density << "- elements:" << elements;
-	std::vector<QStringList>* container = &m_materials;
-	QStringList values;
-	values << name << density << elements;
-	return QVariant( addRecord(container, values) );
+  std::vector<std::vector<std::string>>* container = &m_materials;
+  std::vector<std::string> values;
+  values.push_back( name );
+  values.push_back( std::to_string(density) );
+  values.push_back( elements );
+	return addRecord(container, values);
 }
 
 
-QVariant WriteGeoModel::addElement(const QString name, const QString symbol, const QString elZ, const QString elA)
+unsigned int WriteGeoModel::addElement(const std::string &name, const std::string &symbol, const double &elZ, const double &elA)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::addElement(QString*) - name:" << name << "- symbol: " << symbol << "- elZ:" << elZ << "- elA:" << elA;
-	std::vector<QStringList>* container = &m_elements;
-	QStringList values;
-	values << name << symbol << elZ << elA;
-	return QVariant( addRecord(container, values) );
+  std::vector<std::vector<std::string>>* container = &m_elements;
+  std::vector<std::string> values;
+  values.insert(values.begin(), { name, symbol, std::to_string(elZ), std::to_string(elA)} );
+	return addRecord(container, values);
 }
 
 
-QVariant WriteGeoModel::addNameTag(const QString name)
+unsigned int WriteGeoModel::addNameTag(const std::string &name)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::addNameTag(QString*) - name:" << name;
-	std::vector<QStringList>* container = &m_nameTags;
-	QStringList values;
-	values << name;
-	return QVariant( addRecord(container, values) );
+	std::vector<std::vector<std::string>>* container = &m_nameTags;
+	std::vector<std::string> values;
+	values.push_back(name);
+	return addRecord(container, values);
 }
 
-QVariant WriteGeoModel::addSerialDenominator(const QString &baseName)
+unsigned int WriteGeoModel::addSerialDenominator(const std::string &baseName)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::addSerialDenominator(QString*) - basename:" << baseName;
-	std::vector<QStringList>* container = &m_serialDenominators;
-	QStringList values;
-	values << baseName;
-	return QVariant( addRecord(container, values) );
+	std::vector<std::vector<std::string>>* container = &m_serialDenominators;
+	std::vector<std::string> values;
+	values.push_back(baseName);
+	return addRecord(container, values);
 }
 
 
-QVariant WriteGeoModel::addFunction(const QString expression)
+unsigned int WriteGeoModel::addFunction(const std::string &expression)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::addFunction(QString*) - expression:" << expression;
-	std::vector<QStringList>* container = &m_functions;
-	QStringList values;
-	values << expression;
-	return QVariant( addRecord(container, values) );
+	std::vector<std::vector<std::string>>* container = &m_functions;
+	std::vector<std::string> values;
+	values.push_back(expression);
+	return addRecord(container, values);
 }
 
 
-QVariant WriteGeoModel::addAlignableTransform(const std::vector<double> params)
+unsigned int WriteGeoModel::addAlignableTransform(const std::vector<double> &params)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::addAlignableTransform(QString*)";
-	std::vector<QStringList>* container = &m_alignableTransforms;
-	QStringList values;
-	foreach(double par, params) {
-		values << QString::number(par);
+	std::vector<std::vector<std::string>>* container = &m_alignableTransforms;
+	std::vector<std::string> values;
+  for(const double& par : params) {
+    values.push_back( std::to_string(par) );
 	}
-	return QVariant( addRecord(container, values) );
+	return addRecord(container, values);
 }
 
 
 
-QVariant WriteGeoModel::addTransform(const std::vector<double> params)
+unsigned int WriteGeoModel::addTransform(const std::vector<double> &params)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::addTransform(QString*)";
-	std::vector<QStringList>* container = &m_transforms;
-	QStringList values;
-	foreach(double par, params) {
-		values << QString::number(par);
+	std::vector<std::vector<std::string>>* container = &m_transforms;
+	std::vector<std::string> values;
+  for(const double& par : params) {
+		values.push_back( std::to_string(par) );
 	}
-	return QVariant( addRecord(container, values) );
+	return addRecord(container, values);
 }
 
-QString WriteGeoModel::getIdFromNodeType( QString nodeType )
+  unsigned int WriteGeoModel::getIdFromNodeType( const std::string &nodeType )
 {
-        //JFB Commented out: qDebug() << "getIdFromNodeType(" << nodeType <<")";
-		if (m_memMap_Tables.contains(nodeType))
-			return QString::number(m_memMap_Tables.value(nodeType));
-		else
-			return QString("NULL");
+  std::unordered_map<std::string, unsigned int>::iterator it = m_memMap_Tables.find(nodeType);
+  if ( it != m_memMap_Tables.end() ) { // item found
+      return m_memMap_Tables.at(nodeType);
+  }
+  return 0; // item not found
 }
 
-QVariant WriteGeoModel::addSerialTransformer(const QVariant &funcId, const QVariant &physvolId, const QString volType, const unsigned int &copies)
+  unsigned int WriteGeoModel::addSerialTransformer(const unsigned int &funcId, const unsigned int &physvolId, const std::string volType, const unsigned int &copies)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::addSerialTransformer()";
-	std::vector<QStringList>* container = &m_serialTransformers;
-	QString volTypeID = getIdFromNodeType(volType);
+	std::vector<std::vector<std::string>>* container = &m_serialTransformers;
+  const unsigned int volTypeID = getIdFromNodeType(volType);
 
-	QStringList values;
-	values << funcId.toString() << physvolId.toString() << volTypeID << QString::number(copies);
+  std::vector<std::string> values;
+//  values << funcId.toString() << physvolId.toString() << volTypeID << QString::number(copies);
+  values.insert( values.begin(),  {std::to_string(funcId), std::to_string(physvolId), std::to_string(volTypeID), std::to_string(copies)} );
 
-	return QVariant( addRecord(container, values) );
+	return addRecord(container, values);
 }
 
-  QVariant WriteGeoModel::addShape(const std::string &type, const std::string &parameters)
+  unsigned int WriteGeoModel::addShape(const std::string &type, const std::string &parameters)
 {
-//  std::vector<QStringList>* container = &m_shapes;
   std::vector<std::vector<std::string>>* container = &m_shapes;
-  
-//  QStringList values;
   std::vector<std::string> values;
-  
-//  values << type << parameters;
   values.push_back(type);
   values.push_back(parameters);
-  
-	return QVariant( addRecord(container, values) );
+	return addRecord(container, values);
 }
 
 
-QVariant WriteGeoModel::addPhysVol(const QVariant &logVolId, const QVariant &parentPhysVolId, bool isRootVolume)
+unsigned int WriteGeoModel::addPhysVol(const unsigned int &logVolId, const unsigned int &parentPhysVolId, const bool &isRootVolume)
 {
-	std::vector<QStringList>* container = &m_physVols;
-
-	QStringList values;
-	values << logVolId.toString() << parentPhysVolId.toString(); // TODO: we should remove the parent info: it's not complete because the type is missing (PhysVol or FullPhysVol) and it's redundant, because we store the childrenPositions. It's only useful for quick visual debug, by dumping the PhysVol DB table
-
+	std::vector<std::vector<std::string>>* container = &m_physVols;
+  std::vector<std::string> values;
+  values.push_back( std::to_string(logVolId) ); //<< parentPhysVolId; // TODO: we should remove the parent info: it's not complete because the type is missing (PhysVol or FullPhysVol) and it's redundant, because we store the childrenPositions. It's only useful for quick visual debug, by dumping the PhysVol DB table
 	unsigned int idx = addRecord(container, values);
-
 	if (isRootVolume) {
-		QStringList rootValues;
-		rootValues << QString::number(idx) << "GeoPhysVol";
+		std::vector<std::string> rootValues;
+    rootValues.insert(rootValues.begin(), { std::to_string(idx), "GeoPhysVol"} );
 		m_rootVolume = rootValues;
 	}
-	return QVariant(idx);
+	return idx;
 }
 
 
-QVariant WriteGeoModel::addFullPhysVol(const QVariant &logVolId, const QVariant &parentPhysVolId, bool isRootVolume)
+unsigned int WriteGeoModel::addFullPhysVol(const unsigned int &logVolId, const unsigned int &parentPhysVolId, const bool &isRootVolume)
 {
-	std::vector<QStringList>* container = &m_fullPhysVols;
-
-	QStringList values;
-	values << logVolId.toString() << parentPhysVolId.toString(); // TODO: we should remove the parent info: it's not complete because the type is missing (PhysVol or FullPhysVol) and it's redundant, because we store the childrenPositions. It's only useful for quick visual debug, by dumping the PhysVol DB table
-
+	std::vector<std::vector<std::string>>* container = &m_fullPhysVols;
+	std::vector<std::string> values;
+  values.push_back( std::to_string(logVolId) ); // << parentPhysVolId.toString(); // TODO: we should remove the parent info: it's not complete because the type is missing (PhysVol or FullPhysVol) and it's redundant, because we store the childrenPositions. It's only useful for quick visual debug, by dumping the PhysVol DB table
 	unsigned int idx = addRecord(container, values);
-
 	if (isRootVolume) {
-		QStringList rootValues;
-		rootValues << QString::number(idx) << "GeoFullPhysVol";
+		std::vector<std::string> rootValues;
+//    rootValues << QString::number(idx) << "GeoFullPhysVol";
+    rootValues.insert(rootValues.begin(), { std::to_string(idx), "GeoPhysVol"} );
 		m_rootVolume = rootValues;
 	}
-	return QVariant(idx);
+	return idx;
 }
 
-QVariant WriteGeoModel::addLogVol(const QString &name, const QVariant &shapeId, const QVariant &materialId)
+unsigned int WriteGeoModel::addLogVol(const std::string &name, const unsigned int &shapeId, const unsigned int &materialId)
 {
-	std::vector<QStringList>* container = &m_logVols;
-	QStringList values;
-	values << name << shapeId.toString() << materialId.toString();
-	return QVariant( addRecord(container, values) );
+	std::vector<std::vector<std::string>>* container = &m_logVols;
+  std::vector<std::string> values;
+  values.insert( values.begin(), {name, std::to_string(shapeId), std::to_string(materialId)} );
+	return addRecord(container, values);
 }
 
 
-void WriteGeoModel::addChildPosition(const QVariant parentId, const QString parentType, const QVariant childId, const unsigned int parentCopyN, const unsigned int childPos, const QString childType, const unsigned int childCopyN)
+  void WriteGeoModel::addChildPosition(const unsigned int &parentId, const std::string &parentType, const unsigned int &childId, const unsigned int &parentCopyN, const unsigned int &childPos, const std::string &childType, const unsigned int &childCopyN)
 {
-	std::vector<QStringList>* container = &m_childrenPositions;
+	std::vector<std::vector<std::string>>* container = &m_childrenPositions;
+	const unsigned int parentTableID = getIdFromNodeType(parentType);
+	const unsigned int childTableID = getIdFromNodeType(childType);
 
-	QString parentTableID = getIdFromNodeType(parentType);
-	QString childTableID = getIdFromNodeType(childType);
-
-	QStringList values;
-	values << parentId.toString() << parentTableID <<  QString::number(parentCopyN) << QString::number(childPos) << childTableID << childId.toString() << QString::number(childCopyN);
+	std::vector<std::string> values;
+//  values << parentId.toString() << parentTableID <<  QString::number(parentCopyN) << QString::number(childPos) << childTableID << childId.toString() << QString::number(childCopyN);
+  values.insert(values.begin(), { std::to_string(parentId), std::to_string(parentTableID), std::to_string(parentCopyN), std::to_string(childPos), std::to_string(childTableID), std::to_string(childId), std::to_string(childCopyN)} );
 	addRecord(container, values);
 	return;
 }
@@ -1668,8 +1553,7 @@ void WriteGeoModel::addChildPosition(const QVariant parentId, const QString pare
 
 void WriteGeoModel::saveToDB()
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::savetoDB()";
-    std::cout << "saving to file: " << m_dbpath.toStdString() << std::endl;
+    std::cout << "Saving the GeoModel tree to file: '" << m_dbpath << "'" << std::endl;
 
 	m_dbManager->addListOfRecords("GeoMaterial", m_materials);
 	m_dbManager->addListOfRecords("GeoElement", m_elements);
@@ -1695,30 +1579,29 @@ void WriteGeoModel::saveToDB()
 
 	return;
 }
+ 
 
-
-void WriteGeoModel::storeAddress(const QString address, QVariant id)
+  void WriteGeoModel::storeAddress(const std::string &address, const unsigned int &id)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::storeAddress(" << address << "," << id << ")";
-	m_memMap.insert(address, id);
+  m_memMap.insert( std::pair<std::string,unsigned int>(address, id) );
+//  m_memMap.insert(address, id);
 }
 
-bool WriteGeoModel::isAddressStored(const QString address)
+  bool WriteGeoModel::isAddressStored(const std::string &address)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::isAddressStored(): " << address;
 	//showMemoryMap(); // only for Debug
-	return m_memMap.contains(address);
+  std::unordered_map<std::string, unsigned int>::iterator it = m_memMap.find(address);
+  return ( it != m_memMap.end() );
 }
 
 
-QVariant WriteGeoModel::getStoredIdFromAddress(QString address)
+  unsigned int WriteGeoModel::getStoredIdFromAddress(const std::string &address)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::getStoredIdFromAddress(): " << address;
-	return m_memMap.value(address);
+	return m_memMap.at(address);
 }
 
 // get pointer string
-QString WriteGeoModel::getAddressStringFromPointer(const GeoMaterial* pointer)
+  std::string WriteGeoModel::getAddressStringFromPointer(const GeoMaterial* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoMaterial*)";
 	std::ostringstream oss;
@@ -1726,7 +1609,7 @@ QString WriteGeoModel::getAddressStringFromPointer(const GeoMaterial* pointer)
 	return getQStringFromOss(oss);
 }
 // get pointer string
-QString WriteGeoModel::getAddressStringFromPointer(const GeoElement* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoElement* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoElement*)";
 	std::ostringstream oss;
@@ -1734,7 +1617,7 @@ QString WriteGeoModel::getAddressStringFromPointer(const GeoElement* pointer)
 	return getQStringFromOss(oss);
 }
 // get pointer string
-QString WriteGeoModel::getAddressStringFromPointer(const GeoShape* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoShape* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoShape*)";
 	std::ostringstream oss;
@@ -1742,7 +1625,7 @@ QString WriteGeoModel::getAddressStringFromPointer(const GeoShape* pointer)
 	return getQStringFromOss(oss);
 }
 // get pointer string
-QString WriteGeoModel::getAddressStringFromPointer(const GeoLogVol* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoLogVol* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoLogVol*)";
 	std::ostringstream oss;
@@ -1750,14 +1633,14 @@ QString WriteGeoModel::getAddressStringFromPointer(const GeoLogVol* pointer)
 	return getQStringFromOss(oss);
 }
 // get pointer string
-QString WriteGeoModel::getAddressStringFromPointer(const GeoPhysVol* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoPhysVol* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoPhysVol*)";
 	std::ostringstream oss;
 	oss << pointer;
 	return getQStringFromOss(oss);
 }
-QString WriteGeoModel::getAddressStringFromPointer(const GeoVPhysVol* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoVPhysVol* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoVPhysVol*)";
 	std::ostringstream oss;
@@ -1765,21 +1648,21 @@ QString WriteGeoModel::getAddressStringFromPointer(const GeoVPhysVol* pointer)
 	return getQStringFromOss(oss);
 }
 // get pointer string
-QString WriteGeoModel::getAddressStringFromPointer(const GeoSerialDenominator* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoSerialDenominator* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoSerialDenominator*)";
 	std::ostringstream oss;
 	oss << pointer;
 	return getQStringFromOss(oss);
 }
-QString WriteGeoModel::getAddressStringFromPointer(const GeoSerialTransformer* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoSerialTransformer* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoSerialTransformer*)";
 	std::ostringstream oss;
 	oss << pointer;
 	return getQStringFromOss(oss);
 }
-QString WriteGeoModel::getAddressStringFromPointer(const GeoXF::Function* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoXF::Function* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoXF::Function*)";
 	std::ostringstream oss;
@@ -1787,7 +1670,7 @@ QString WriteGeoModel::getAddressStringFromPointer(const GeoXF::Function* pointe
 	return getQStringFromOss(oss);
 }
 
-QString WriteGeoModel::getAddressStringFromPointer(const GeoTransform* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoTransform* pointer)
 {
 	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoTransform*)";
 	std::ostringstream oss;
@@ -1795,21 +1678,17 @@ QString WriteGeoModel::getAddressStringFromPointer(const GeoTransform* pointer)
 	return getQStringFromOss(oss);
 }
 
-QString WriteGeoModel::getAddressStringFromPointer(const GeoNameTag* pointer)
+std::string WriteGeoModel::getAddressStringFromPointer(const GeoNameTag* pointer)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::getAddressStringFromPointer(GeoNameTag*)";
 	std::ostringstream oss;
 	oss << pointer;
 	return getQStringFromOss(oss);
 }
 
-QString WriteGeoModel::getQStringFromOss(std::ostringstream &oss)
+std::string WriteGeoModel::getQStringFromOss(std::ostringstream &oss)
 {
-	//JFB Commented out: qDebug() << "WriteGeoModel::getQStringFromOss()";
 	std::string addr = oss.str();
-	QString address = QString::fromStdString(addr);
-	//JFB Commented out: qDebug() << "address string:" << address;
-	return address;
+	return addr;
 }