diff --git a/src/Client.cpp b/src/Client.cpp
index abb1439f7a2f851c95ad35f53a1db00a75ee577e..45f3e48d86385136a7a971946d234306af3875c8 100644
--- a/src/Client.cpp
+++ b/src/Client.cpp
@@ -53,7 +53,7 @@ void Client::start()
 {
     DEBUG_STREAM << "Client::start()" << endl;
 
-    m_dBManager_sp->connect();
+    m_dBManager_sp->connectAll();
 
     m_protocolManager_sp = ProtocolManager::create(m_deviceImpl_p,
         m_configuration_sp, m_dBManager_sp);
@@ -91,7 +91,10 @@ void Client::stop()
 
     m_protocolManager_sp.reset();
 
-    m_dBManager_sp->disconnect();
+    m_dBManager_sp->disconnectAll();
+
+    writeState(Tango::OFF);
+    writeStatus("Database loop paused");
 }
 
 //==============================================================================
@@ -188,7 +191,7 @@ void Client::startUpdateLists()
         m_protocolManager_sp->updateFileLists();
 
         writeState(Tango::ON);
-        writeStatus("Looking for new files");
+        writeStatus("Database loop active");
     }
     catch(std::exception& ec)
     {
@@ -341,8 +344,7 @@ void Client::handleReadResponseBody(const boost::system::error_code& errorCode)
         {
             WARN_STREAM << "Client::handleReadResponseBody() " << ec.what() << endl;
 
-            writeState(Tango::ALARM);
-            writeStatus(ec.what());
+            onTransferFailed();
         }
         catch(std::runtime_error& ec)
         {
@@ -387,30 +389,14 @@ void Client::handleReadData(FileWrapper::SP fileWrapper_sp, std::size_t recvByte
             }
             else
             {
-                INFO_STREAM << "Client::handleReadData() transfer complete " << endl;
-
-                m_protocolManager_sp->markAsCompleted();
-
-                m_protocolManager_sp->nextFile();
-
-                if(m_protocolManager_sp->hasNextFile())
-                {
-                    startWriteRequest();
-                }
-                else
-                {
-                    closeConnection();
-
-                    startUpdateLists();
-                }
+                onTransferCompleted(fileWrapper_sp);
             }
         }
         else
         {
-            ERROR_STREAM << "Client::handleReadData() bad I/O" << endl;
+            WARN_STREAM << "Client::handleReadData() bad I/O" << endl;
 
-            writeState(Tango::ALARM);
-            writeStatus("Bad I/O");
+            onTransferFailed();
         }
     }
     else
@@ -423,6 +409,86 @@ void Client::handleReadData(FileWrapper::SP fileWrapper_sp, std::size_t recvByte
     }
 }
 
+//==============================================================================
+//      Client::onTransferCompleted()
+//==============================================================================
+void Client::onTransferCompleted(FileWrapper::SP fileWrapper_sp)
+{
+    DEBUG_STREAM << "Client::onTransferCompleted()" << endl;
+
+    try
+    {
+        m_protocolManager_sp->setFileTransfered(fileWrapper_sp);
+
+        m_protocolManager_sp->nextFile();
+
+        if(m_protocolManager_sp->hasNextFile())
+        {
+            startWriteRequest();
+        }
+        else
+        {
+            closeConnection();
+
+            startUpdateLists();
+        }
+    }
+    catch(std::exception& ec)
+    {
+        ERROR_STREAM << "Client::onTransferCompleted() " << ec.what() << endl;
+
+        writeState(Tango::ALARM);
+        writeStatus(ec.what());
+    }
+    catch(...)
+    {
+        ERROR_STREAM << "Client::onTransferCompleted() Unknown error" << endl;
+
+        writeState(Tango::ALARM);
+        writeStatus("Unknown error");
+    }
+}
+
+//==============================================================================
+//      Client::onTransferFailed()
+//==============================================================================
+void Client::onTransferFailed()
+{
+    DEBUG_STREAM << "Client::onTransferFailed()" << endl;
+
+    try
+    {
+        m_protocolManager_sp->setFileFailed();
+
+        m_protocolManager_sp->nextFile();
+
+        if(m_protocolManager_sp->hasNextFile())
+        {
+            startWriteRequest();
+        }
+        else
+        {
+            closeConnection();
+
+            startUpdateLists();
+        }
+    }
+    catch(std::exception& ec)
+    {
+        ERROR_STREAM << "Client::onTransferFailed() " << ec.what() << endl;
+
+        writeState(Tango::ALARM);
+        writeStatus(ec.what());
+    }
+    catch(...)
+    {
+        ERROR_STREAM << "Client::onTransferFailed() Unknown error" << endl;
+
+        writeState(Tango::ALARM);
+        writeStatus("Unknown error");
+    }
+}
+
 //==============================================================================
 //      Client::resetConnection()
 //==============================================================================
diff --git a/src/Client.h b/src/Client.h
index f95b05bd2010b77ad540342680d5579f196ad079..471025144dd6a5f8abd715f54a9650d9d302e0af 100644
--- a/src/Client.h
+++ b/src/Client.h
@@ -116,6 +116,13 @@ protected:
     virtual void handleReadData(FileWrapper::SP, std::size_t,
         const boost::system::error_code&);
 
+//------------------------------------------------------------------------------
+//  [Protected] Transfer result methods
+//------------------------------------------------------------------------------
+    void onTransferCompleted(FileWrapper::SP);
+
+    void onTransferFailed();
+
 //------------------------------------------------------------------------------
 //  [Protected] Connection reset and timeout handler methods
 //------------------------------------------------------------------------------
diff --git a/src/DBManager.cpp b/src/DBManager.cpp
index 93d423a6d30510785cdb4172871e81be4d81166a..8d09bee3d008a352768f07f16b8e3d323f66aaf8 100644
--- a/src/DBManager.cpp
+++ b/src/DBManager.cpp
@@ -52,7 +52,7 @@ DBManager::SP DBManager::create(Tango::DeviceImpl* deviceImpl_p,
 //==============================================================================
 //      DBManager::connect()
 //==============================================================================
-void DBManager::connect() throw(soci::soci_error)
+void DBManager::connectAll() throw(soci::soci_error)
 {
     DEBUG_STREAM << "DBManager::connect()" << endl;
 
@@ -88,7 +88,7 @@ void DBManager::connect() throw(soci::soci_error)
 //==============================================================================
 //      DBManager::disconnect()
 //==============================================================================
-void DBManager::disconnect()
+void DBManager::disconnectAll()
 {
     DEBUG_STREAM << "DBManager::disconnect()" << endl;
 
@@ -99,6 +99,34 @@ void DBManager::disconnect()
     m_auxSession_sp->close();
 }
 
+//==============================================================================
+//      DBManager::getMainTransaction()
+//==============================================================================
+DBManager::TransactionSP DBManager::getMainTransaction()
+{
+    DEBUG_STREAM << "DBManager::getMainTransaction()" << endl;
+
+    boost::mutex::scoped_lock lock(m_sessionMutex);
+
+    TransactionSP transaction_sp(new soci::transaction(*m_mainSession_sp));
+
+    return transaction_sp;
+}
+
+//==============================================================================
+//      DBManager::getAuxTransaction()
+//==============================================================================
+DBManager::TransactionSP DBManager::getAuxTransaction()
+{
+    DEBUG_STREAM << "DBManager::getAuxTransaction()" << endl;
+
+    boost::mutex::scoped_lock lock(m_sessionMutex);
+
+    TransactionSP transaction_sp(new soci::transaction(*m_auxSession_sp));
+
+    return transaction_sp;
+}
+
 //==============================================================================
 //      DBManager::retrieveNewFiles()
 //==============================================================================
@@ -134,10 +162,10 @@ void DBManager::updateNewFilePath(std::string storagePath, std::string filePath,
     if(m_mainSession_sp->get_backend() == NULL)
         m_mainSession_sp->reconnect();
 
-    *m_mainSession_sp << "insert into " << m_configuration_sp->getDatabaseSchema()
-        << "." << m_configuration_sp->getDatabaseTable() << " (storage_path, "
-        << "file_path) values (:storagePath, :filePath) where file_version = "
-        << ":fileVersion and file_name like :FileName",
+    *m_mainSession_sp << "update " << m_configuration_sp->getDatabaseSchema()
+        << "." << m_configuration_sp->getDatabaseTable()
+        << " set storage_path = :storagePath, file_path = :filePath "
+        << "  where file_version = :fileVersion and file_name like :fileName",
         soci::use(storagePath, "storagePath"), soci::use(filePath, "filePath"),
         soci::use(fileVersion, "fileVersion"), soci::use(fileName, "fileName");
 }
diff --git a/src/DBManager.h b/src/DBManager.h
index fcdfcf3cbdd8e235c81526e3a0a953470b3356bd..242db01f96d600f5a7aa3e8ae733247e4414d8be 100644
--- a/src/DBManager.h
+++ b/src/DBManager.h
@@ -61,11 +61,20 @@ public:
     static DBManager::SP create(Tango::DeviceImpl*, Configuration::SP);
 
 //------------------------------------------------------------------------------
-//  [Public] Connection handling methods
+//  [Public] Connections handling methods
 //------------------------------------------------------------------------------
-    virtual void connect() throw(soci::soci_error);
+    virtual void connectAll() throw(soci::soci_error);
 
-    virtual void disconnect();
+    virtual void disconnectAll();
+
+//------------------------------------------------------------------------------
+//  [Public] Transaction retriever methods
+//------------------------------------------------------------------------------
+    typedef boost::shared_ptr<soci::transaction> TransactionSP;
+
+    TransactionSP getMainTransaction();
+
+    TransactionSP getAuxTransaction();
 
 //------------------------------------------------------------------------------
 //  [Public] New file method
diff --git a/src/FileWrapper.cpp b/src/FileWrapper.cpp
index 533ccd4e297fc403b97e511ee58b23fb13914930..e01d2b58d547d7572d76b322e3621681051c8c97 100644
--- a/src/FileWrapper.cpp
+++ b/src/FileWrapper.cpp
@@ -7,13 +7,34 @@ namespace DataImporter_ns
 //      FileWrapper::FileWrapper()
 //==============================================================================
 FileWrapper::FileWrapper(Tango::DeviceImpl* deviceImpl_p,
-    boost::filesystem::path filePath, boost::uint64_t totalFileSize) :
-    Tango::LogAdapter(deviceImpl_p), m_totalFileSize(totalFileSize)
+    std::string storagePath, std::string filePath, int fileVersion,
+    std::string fileName, boost::uint64_t totalFileSize) throw(std::logic_error)
+    : Tango::LogAdapter(deviceImpl_p), m_storagePath(storagePath),
+    m_filePath(filePath), m_fileVersion(fileVersion), m_fileName(fileName),
+    m_totalFileSize(totalFileSize)
 
 {
     DEBUG_STREAM << "FileWrapper::FileWrapper()" << endl;
 
-    m_outputFileStream.open(filePath.string(), std::ios::binary);
+    boost::filesystem::path destPath(storagePath);
+
+    destPath /= filePath;
+
+    std::stringstream fileStream;
+    fileStream << "/" << fileVersion;
+
+    destPath /= fileStream.str();
+
+    if(!boost::filesystem::exists(destPath))
+            boost::filesystem::create_directories(destPath);
+
+    if(!boost::filesystem::is_directory(destPath))
+        throw std::logic_error("Destination path \'"
+            + destPath.string() + "\' is not a directory" );
+
+    destPath /= fileName;
+
+    m_outputFileStream.open(destPath.string(), std::ios::binary);
 }
 
 //==============================================================================
@@ -30,14 +51,56 @@ FileWrapper::~FileWrapper()
 //      FileWrapper::create()
 //==============================================================================
 FileWrapper::SP FileWrapper::create(Tango::DeviceImpl* deviceImpl_p,
-    boost::filesystem::path filePath, boost::uint64_t totalFileSize)
+    std::string storagePath, std::string filePath, int fileVersion,
+    std::string fileName, boost::uint64_t fileSize)
+    throw(std::logic_error)
 {
-    FileWrapper::SP d_sp(new FileWrapper(deviceImpl_p, filePath, totalFileSize),
-        FileWrapper::Deleter());
+    FileWrapper::SP d_sp(new FileWrapper(deviceImpl_p, storagePath, filePath,
+        fileVersion, fileName, fileSize), FileWrapper::Deleter());
 
     return d_sp;
 }
 
+//==============================================================================
+//      FileWrapper::getStoragePath()
+//==============================================================================
+std::string FileWrapper::getStoragePath()
+{
+    DEBUG_STREAM << "FileWrapper::getStoragePath()" << endl;
+
+    return m_storagePath;
+}
+
+//==============================================================================
+//      FileWrapper::getFilePath()
+//==============================================================================
+std::string FileWrapper::getFilePath()
+{
+    DEBUG_STREAM << "FileWrapper::getFilePath()" << endl;
+
+    return m_filePath;
+}
+
+//==============================================================================
+//      FileWrapper::getFileVersion()
+//==============================================================================
+int FileWrapper::getFileVersion()
+{
+    DEBUG_STREAM << "FileWrapper::getFileVersion()" << endl;
+
+    return m_fileVersion;
+}
+
+//==============================================================================
+//      FileWrapper::getFileName()
+//==============================================================================
+std::string FileWrapper::getFileName()
+{
+    DEBUG_STREAM << "FileWrapper::getFileName()" << endl;
+
+    return m_fileName;
+}
+
 //==============================================================================
 //      FileWrapper::isOpen()
 //==============================================================================
diff --git a/src/FileWrapper.h b/src/FileWrapper.h
index c18e26ea5d051f83826931e96ee4079b39b44576..d8718ea0b61c5dfc06f2a638b9105286e1af9caa 100644
--- a/src/FileWrapper.h
+++ b/src/FileWrapper.h
@@ -20,7 +20,8 @@ protected:
 //------------------------------------------------------------------------------
 //  [Protected] Constructor destructor deleter
 //------------------------------------------------------------------------------
-    FileWrapper(Tango::DeviceImpl*, boost::filesystem::path, boost::uint64_t);
+    FileWrapper(Tango::DeviceImpl*, std::string, std::string, int, std::string,
+        boost::uint64_t) throw(std::logic_error);
 
     virtual ~FileWrapper();
 
@@ -36,8 +37,19 @@ public:
 //------------------------------------------------------------------------------
 //	[Public] Class creation method
 //------------------------------------------------------------------------------
-    static FileWrapper::SP create(Tango::DeviceImpl*,
-        boost::filesystem::path, boost::uint64_t);
+    static FileWrapper::SP create(Tango::DeviceImpl*, std::string, std::string,
+        int, std::string, boost::uint64_t) throw(std::logic_error);
+
+//------------------------------------------------------------------------------
+//	[Public] Properties getter methods
+//------------------------------------------------------------------------------
+    virtual std::string getStoragePath();
+
+    virtual std::string getFilePath();
+
+    virtual int getFileVersion();
+
+    virtual std::string getFileName();
 
 //------------------------------------------------------------------------------
 //	[Public] Input stream methods
@@ -56,6 +68,18 @@ protected:
 //------------------------------------------------------------------------------
 //  [Protected] Class variables
 //------------------------------------------------------------------------------
+    //Storage path property
+    const std::string m_storagePath;
+
+    //File path property
+    const std::string m_filePath;
+
+    //File version property
+    const int m_fileVersion;
+
+    //File name property
+    const std::string m_fileName;
+
     //Input file size
     boost::uint64_t m_totalFileSize;
 
diff --git a/src/PlainClient.cpp b/src/PlainClient.cpp
index 13dfdce7f96917584fe932b11b54c55eaa1f0247..a2446595542cbd42198cf54eab5ca5b013bb5482 100644
--- a/src/PlainClient.cpp
+++ b/src/PlainClient.cpp
@@ -57,6 +57,7 @@ void PlainClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPoint
 
         DEBUG_STREAM << "PlainClient::startConnect() " << infoStream.str() << endl;
 
+        writeState(Tango::RUNNING);
         writeStatus(infoStream.str());
 
         m_plainSocket.async_connect(endPointIterator->endpoint(),
@@ -147,8 +148,7 @@ void PlainClient::startWriteRequest()
     {
         WARN_STREAM << "PlainClient::startWriteRequest() " << ec.what() << endl;
 
-        writeState(Tango::ALARM);
-        writeStatus(ec.what());
+        onTransferFailed();
     }
     catch(std::runtime_error& ec)
     {
diff --git a/src/ProtocolManager.cpp b/src/ProtocolManager.cpp
index 9e1fdfacd353ca22ad43bf6880756e57137fdca4..ad22172f2c946a950440b7cb5c138cc21f2cb406 100644
--- a/src/ProtocolManager.cpp
+++ b/src/ProtocolManager.cpp
@@ -49,7 +49,7 @@ void ProtocolManager::setRemoteEndpoint(std::string remoteEndpoint)
 //==============================================================================
 //      ProtocolManager::updateFileLists()
 //==============================================================================
-void ProtocolManager::updateFileLists() throw(soci::soci_error)
+void ProtocolManager::updateFileLists() throw(std::runtime_error)
 {
     DEBUG_STREAM << "ProtocolManager::updateFileLists()" << endl;
 
@@ -60,11 +60,9 @@ void ProtocolManager::updateFileLists() throw(soci::soci_error)
         << boost::posix_time::to_simple_string(m_lastTimestamp) << endl;
 
     m_newFileRowset_sp = m_dBManager_sp->retrieveNewFiles(m_lastTimestamp);
-
     m_newFileRowsetIt = m_newFileRowset_sp->begin();
 
     m_failedFileRowset_sp = m_dBManager_sp->retrieveFailedFiles();
-
     m_failedFileRowsetIt = m_failedFileRowset_sp->begin();
 }
 
@@ -100,58 +98,6 @@ bool ProtocolManager::hasNextFile()
     }
 }
 
-//==============================================================================
-//      ProtocolManager::markAsCompleted()
-//==============================================================================
-void ProtocolManager::markAsCompleted()
-{
-    DEBUG_STREAM << "ProtocolManager::markAsCompleted()" << endl;
-
-    if(!m_recoveryMode)
-    {
-        if(!m_newFileRowset_sp ||
-            m_newFileRowsetIt == m_newFileRowset_sp->end())
-                throw std::runtime_error("New list not initialized or empty");
-
-        if(!m_newFileRowsetIt->get<0>())
-            throw std::invalid_argument("Empty file version found on new list");
-        int fileVersion = m_newFileRowsetIt->get<0>().get();
-
-        if(!m_newFileRowsetIt->get<1>())
-            throw std::invalid_argument("Empty file name found on new list");
-        std::string fileName = m_newFileRowsetIt->get<1>().get();
-
-        if(!m_newFileRowsetIt->get<2>())
-            throw std::invalid_argument("Empty update time found on new list");
-        std::tm update_time = m_newFileRowsetIt->get<2>().get();
-
-        INFO_STREAM << "ProtocolManager::createRequest() mark completed "
-            << fileName << " version " << fileVersion << endl;
-
-        boost::posix_time::ptime current_time =
-            boost::posix_time::ptime_from_tm(update_time);
-
-        INFO_STREAM << "ProtocolManager::createRequest() "
-            << boost::posix_time::to_simple_string(current_time) << endl;
-
-        m_dBManager_sp->persistLastTimestamp(current_time);
-    }
-    else
-    {
-        ERROR_STREAM << "ProtocolManager::createRequest() mark failed list" << endl;
-    }
-}
-
-//==============================================================================
-//      ProtocolManager::markAsFailed()
-//==============================================================================
-void ProtocolManager::markAsFailed()
-{
-    DEBUG_STREAM << "ProtocolManager::markAsFailed()" << endl;
-
-
-}
-
 //==============================================================================
 //      ProtocolManager::nextFile()
 //==============================================================================
@@ -269,26 +215,14 @@ FileWrapper::SP ProtocolManager::processResponse(ResponseSP response_sp)
 
     boost::uint64_t fileSize = response_sp->file_size();
 
-    boost::filesystem::path destPath = composePath(
-        m_configuration_sp->getStoragePath(), filePath, fileVersion);
-
-    if(!boost::filesystem::exists(destPath))
-            boost::filesystem::create_directories(destPath);
-
-    if(!boost::filesystem::is_directory(destPath))
-        throw std::invalid_argument("Destination path \'"
-            + destPath.string() + "\' is not a directory" );
-
-    FileWrapper::SP fileWrapper_sp;
-
     if(response_sp->state() == Response::REQUEST_ACCEPTED)
     {
         INFO_STREAM << "ProtocolManager::processResponse()  transfer file "
             << fileName << " version " << fileVersion << " size " << fileSize << endl;
 
-        destPath /= fileName;
-
-        fileWrapper_sp = FileWrapper::create(m_deviceImpl_p, destPath, fileSize);
+        return FileWrapper::create(m_deviceImpl_p,
+            m_configuration_sp->getStoragePath(), filePath,
+            fileVersion, fileName, fileSize);
     }
     else if(response_sp->state() == Response::METADATA_NOT_FOUND ||
         response_sp->state() == Response::FILE_NOT_DOWNLOADED ||
@@ -297,33 +231,110 @@ FileWrapper::SP ProtocolManager::processResponse(ResponseSP response_sp)
         throw std::logic_error(response_sp->status());
     }
     else
-    {
         throw std::runtime_error(response_sp->status());
-    }
-
-    return fileWrapper_sp;
 }
 
 //==============================================================================
-//      ProtocolManager::composePath()
+//      ProtocolManager::setFileTransfered()
 //==============================================================================
-boost::filesystem::path ProtocolManager::composePath(std::string storagePath,
-     std::string filePath, int fileVersion)
+void ProtocolManager::setFileTransfered(FileWrapper::SP fileWrapper_sp)
+    throw(std::logic_error, std::runtime_error)
 {
-    DEBUG_STREAM << "ProtocolManager::composePath()" << endl;
+    DEBUG_STREAM << "ProtocolManager::setFileTransfered()" << endl;
+
+    std::string storagePath = fileWrapper_sp->getStoragePath();
+    std::string filePath = fileWrapper_sp->getFilePath();
+
+    if(!m_recoveryMode)
+    {
+        if(!m_newFileRowset_sp ||
+            m_newFileRowsetIt == m_newFileRowset_sp->end())
+                throw std::runtime_error("New list not initialized or empty");
+
+        if(!m_newFileRowsetIt->get<0>())
+            throw std::invalid_argument("Empty file version found on new list");
+        int fileVersion = m_newFileRowsetIt->get<0>().get();
+
+        if(!m_newFileRowsetIt->get<1>())
+            throw std::invalid_argument("Empty file name found on new list");
+        std::string fileName = m_newFileRowsetIt->get<1>().get();
+
+        if(!m_newFileRowsetIt->get<2>())
+            throw std::invalid_argument("Empty update time found on new list");
+        std::tm update_time = m_newFileRowsetIt->get<2>().get();
+
+        INFO_STREAM << "ProtocolManager::setFileTransfered() file "
+            << fileName << " version " << fileVersion << " transfered" << endl;
 
-    boost::filesystem::path path(storagePath);
+        boost::posix_time::ptime newPtime = boost::posix_time::ptime_from_tm(update_time);
 
-    path /= filePath;
+        if(m_currentPtime.is_not_a_date_time())
+            m_currentPtime = newPtime;
 
-    std::stringstream fileStream;
-    fileStream << "/" << fileVersion;
+        DBManager::TransactionSP auxTransaction_sp = m_dBManager_sp->getAuxTransaction();
+        DBManager::TransactionSP mainTransaction_sp = m_dBManager_sp->getMainTransaction();
 
-    path /= fileStream.str();
+        if(newPtime > m_currentPtime)
+            m_dBManager_sp->persistLastTimestamp(newPtime);
+
+        m_dBManager_sp->updateNewFilePath(storagePath, filePath, fileVersion, fileName);
+
+        auxTransaction_sp->commit();
+        mainTransaction_sp->commit();
+    }
+    else
+    {
+        if(!m_failedFileRowset_sp ||
+            m_failedFileRowsetIt == m_failedFileRowset_sp->end())
+                throw std::runtime_error("Failed list not initialized or empty");
+
+        if(!m_failedFileRowsetIt->get<0>())
+            throw std::invalid_argument("Empty file version found on failed list");
+        int fileVersion = m_failedFileRowsetIt->get<0>().get();
+
+        if(!m_failedFileRowsetIt->get<1>())
+            throw std::invalid_argument("Empty file name found on failed list");
+        string fileName = m_failedFileRowsetIt->get<1>().get();
 
-    DEBUG_STREAM << "ProtocolManager::composePath() \'" << path << "\'" << endl;
+        DBManager::TransactionSP auxTransaction_sp = m_dBManager_sp->getAuxTransaction();
+        DBManager::TransactionSP mainTransaction_sp = m_dBManager_sp->getMainTransaction();
 
-    return path;
+        m_dBManager_sp->removeFailedFile(fileVersion, fileName);
+
+        m_dBManager_sp->updateNewFilePath(storagePath, filePath, fileVersion, fileName);
+
+        auxTransaction_sp->commit();
+        mainTransaction_sp->commit();
+    }
+}
+
+//==============================================================================
+//      ProtocolManager::markAsFailed()
+//==============================================================================
+void ProtocolManager::setFileFailed() throw(std::logic_error, std::runtime_error)
+{
+    DEBUG_STREAM << "ProtocolManager::markAsFailed()" << endl;
+
+    if(!m_recoveryMode)
+    {
+        if(!m_newFileRowset_sp ||
+            m_newFileRowsetIt == m_newFileRowset_sp->end())
+                throw std::runtime_error("New list not initialized or empty");
+
+        if(!m_newFileRowsetIt->get<0>())
+            throw std::invalid_argument("Empty file version found on new list");
+        int fileVersion = m_newFileRowsetIt->get<0>().get();
+
+        if(!m_newFileRowsetIt->get<1>())
+            throw std::invalid_argument("Empty file name found on new list");
+        string fileName = m_newFileRowsetIt->get<1>().get();
+
+        m_dBManager_sp->addFailedFile(fileVersion, fileName);
+    }
+    else
+    {
+        //TODO: file failed again -> what to do?
+    }
 }
 
 }   //namespace
diff --git a/src/ProtocolManager.h b/src/ProtocolManager.h
index 42ee2cf76fa97a58c95df2f32702897954487ff2..a005eba0882f21c8f35ba32fa13db26d716c9642 100644
--- a/src/ProtocolManager.h
+++ b/src/ProtocolManager.h
@@ -59,14 +59,10 @@ public:
 //------------------------------------------------------------------------------
 //	[Public] Files list methods
 //------------------------------------------------------------------------------
-    virtual void updateFileLists() throw(soci::soci_error);
+    virtual void updateFileLists() throw(std::runtime_error);
 
     virtual bool hasNextFile();
 
-    virtual void markAsCompleted();
-
-    virtual void markAsFailed();
-
     virtual void nextFile();
 
 //------------------------------------------------------------------------------
@@ -78,12 +74,16 @@ public:
     FileWrapper::SP processResponse(ResponseSP)
         throw(std::logic_error, std::runtime_error);
 
-protected:
 //------------------------------------------------------------------------------
-//  [Protected] File path method
+//	[Public] Files status methods
 //------------------------------------------------------------------------------
-    virtual boost::filesystem::path composePath(std::string, std::string, int);
+    virtual void setFileTransfered(FileWrapper::SP)
+            throw(std::logic_error, std::runtime_error);
+
+    virtual void setFileFailed()
+        throw(std::logic_error, std::runtime_error);
 
+protected:
 //------------------------------------------------------------------------------
 //  [Protected] Class variables
 //------------------------------------------------------------------------------
@@ -99,12 +99,12 @@ protected:
     //Address and port of remote endpoint
     std::string m_remoteEndpoint;
 
-    //New file list current timestamp index
-    boost::posix_time::ptime m_currentTimestamp;
-
     //Processing file from recovery list
     bool m_recoveryMode;
 
+    //New file list current timestamp index
+    boost::posix_time::ptime m_currentPtime;
+
     //New file list shared pointer
     DBManager::NewFileRowsetSP m_newFileRowset_sp;
 
diff --git a/src/SSLClient.cpp b/src/SSLClient.cpp
index 8feed20d775c50540efba1a80d7a3f39fec482cb..35201d5a342c57c67f154523d1213de1eab6a244 100644
--- a/src/SSLClient.cpp
+++ b/src/SSLClient.cpp
@@ -75,6 +75,7 @@ void SSLClient::startConnect(boost::asio::ip::tcp::resolver::iterator endPointIt
 
         INFO_STREAM << "SSLClient::startConnect() " << infoStream.str() << endl;
 
+        writeState(Tango::RUNNING);
         writeStatus(infoStream.str());
 
         m_sSLSocket.lowest_layer().async_connect(endPointIterator->endpoint(),
@@ -198,10 +199,9 @@ void SSLClient::startWriteRequest()
     }
     catch(std::logic_error& ec)
     {
-        ERROR_STREAM << "SSLClient::startWriteRequest() " << ec.what() << endl;
+        WARN_STREAM << "SSLClient::startWriteRequest() " << ec.what() << endl;
 
-        writeState(Tango::ALARM);
-        writeStatus(ec.what());
+        onTransferFailed();
     }
     catch(std::runtime_error& ec)
     {