diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp
index 1f926e7790c825f91303165cd438e9ada4c5f7fb..610984b0c2d991b73386f75100294f2a88f56623 100644
--- a/daemon/src/iax/iaxvoiplink.cpp
+++ b/daemon/src/iax/iaxvoiplink.cpp
@@ -396,7 +396,7 @@ IAXVoIPLink::carryingDTMFdigits(const std::string& id, char code)
 }
 
 void
-IAXVoIPLink::sendTextMessage(sfl::InstantMessaging *module,
+IAXVoIPLink::sendTextMessage(sfl::InstantMessaging &module,
                              const std::string& callID,
                              const std::string& message,
                              const std::string& /*from*/)
@@ -404,9 +404,8 @@ IAXVoIPLink::sendTextMessage(sfl::InstantMessaging *module,
     IAXCall* call = getIAXCall(callID);
 
     if (call) {
-        mutexIAX_.enter();
-        module->send_iax_message(call->session, callID, message.c_str());
-        mutexIAX_.leave();
+        ost::MutexLock lock(mutexIAX_);
+        module.send_iax_message(call->session, callID, message.c_str());
     }
 }
 
diff --git a/daemon/src/iax/iaxvoiplink.h b/daemon/src/iax/iaxvoiplink.h
index b8da8b90326376891537a65a6c6f8bf3ad38d00c..d633dbb379de2095831e6cb3d5d355b6c2b313a7 100644
--- a/daemon/src/iax/iaxvoiplink.h
+++ b/daemon/src/iax/iaxvoiplink.h
@@ -167,7 +167,7 @@ class IAXVoIPLink : public VoIPLink {
         virtual void carryingDTMFdigits(const std::string& id, char code);
 
 
-        virtual void sendTextMessage(sfl::InstantMessaging *module, const std::string& callID, const std::string& message, const std::string& from);
+        virtual void sendTextMessage(sfl::InstantMessaging &module, const std::string& callID, const std::string& message, const std::string& from);
 
         /**
          * Return the codec protocol used for this call
diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index 3b452d4830691d649b8691db25b912d6a89a6682..4dcdd49bb2a1898f39841649ed80b51117e6d240 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -85,10 +85,7 @@ ManagerImpl::ManagerImpl() :
 
 // never call if we use only the singleton...
 ManagerImpl::~ManagerImpl()
-{
-    delete imModule_;
-    delete audiofile_;
-}
+{}
 
 void ManagerImpl::init(std::string config_file)
 {
@@ -1424,7 +1421,7 @@ void ManagerImpl::incomingMessage(const std::string& callID,
                 return;
             }
 
-            account->getVoIPLink()->sendTextMessage(imModule_, callID, message, from);
+            account->getVoIPLink()->sendTextMessage(*imModule_, callID, message, from);
         }
 
         // in case of a conference we must notify client using conference id
@@ -1464,7 +1461,7 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string&
                 return false;
             }
 
-            account->getVoIPLink()->sendTextMessage(imModule_, *iter_p, message, from);
+            account->getVoIPLink()->sendTextMessage(*imModule_, *iter_p, message, from);
         }
 
         return true;
@@ -1491,7 +1488,7 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string&
                 return false;
             }
 
-            account->getVoIPLink()->sendTextMessage(imModule_, *iter_p, message, from);
+            account->getVoIPLink()->sendTextMessage(*imModule_, *iter_p, message, from);
         }
     } else {
         Account *account = getAccount(getAccountFromCall(callID));
@@ -1501,7 +1498,7 @@ bool ManagerImpl::sendTextMessage(const std::string& callID, const std::string&
             return false;
         }
 
-        account->getVoIPLink()->sendTextMessage(imModule_, callID, message, from);
+        account->getVoIPLink()->sendTextMessage(*imModule_, callID, message, from);
     }
 
     return true;
@@ -1684,11 +1681,10 @@ void ManagerImpl::stopTone()
     if (telephoneTone_.get() != NULL)
         telephoneTone_->setCurrentTone(Tone::TONE_NULL);
 
-    if (audiofile_) {
+    if (audiofile_.get()) {
         std::string filepath(audiofile_->getFilePath());
         dbus_.getCallManager()->recordPlaybackStopped(filepath);
-        delete audiofile_;
-        audiofile_ = NULL;
+        audiofile_.reset(0);
     }
 }
 
@@ -1765,24 +1761,22 @@ void ManagerImpl::ringtone(const std::string& accountID)
     {
         ost::MutexLock m(toneMutex_);
 
-        if (audiofile_) {
+        if (audiofile_.get()) {
             dbus_.getCallManager()->recordPlaybackStopped(audiofile_->getFilePath());
-            delete audiofile_;
-            audiofile_ = NULL;
+            audiofile_.reset(0);
         }
 
         try {
             if (ringchoice.find(".wav") != std::string::npos)
-                audiofile_ = new WaveFile(ringchoice, samplerate);
+                audiofile_.reset(new WaveFile(ringchoice, samplerate));
             else {
                 sfl::Codec *codec;
-
                 if (ringchoice.find(".ul") != std::string::npos or ringchoice.find(".au") != std::string::npos)
                     codec = audioCodecFactory.getCodec(PAYLOAD_CODEC_ULAW);
                 else
                     throw AudioFileException("Couldn't guess an appropriate decoder");
 
-                audiofile_ = new RawFile(ringchoice, static_cast<sfl::AudioCodec *>(codec), samplerate);
+                audiofile_.reset(new RawFile(ringchoice, static_cast<sfl::AudioCodec *>(codec), samplerate));
             }
         } catch (const AudioFileException &e) {
             ERROR("Manager: Exception: %s", e.what());
@@ -1807,8 +1801,7 @@ AudioLoop*
 ManagerImpl::getTelephoneFile()
 {
     ost::MutexLock m(toneMutex_);
-
-    return audiofile_;
+    return audiofile_.get();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -2102,14 +2095,13 @@ bool ManagerImpl::startRecordedFilePlayback(const std::string& filepath)
     {
         ost::MutexLock m(toneMutex_);
 
-        if (audiofile_) {
+        if (audiofile_.get()) {
             dbus_.getCallManager()->recordPlaybackStopped(audiofile_->getFilePath());
-            delete audiofile_;
-            audiofile_ = NULL;
+            audiofile_.reset(0);
         }
 
         try {
-            audiofile_ = new WaveFile(filepath, sampleRate);
+            audiofile_.reset(new WaveFile(filepath, sampleRate));
         } catch (const AudioFileException &e) {
             ERROR("Manager: Exception: %s", e.what());
         }
@@ -2133,8 +2125,7 @@ void ManagerImpl::stopRecordedFilePlayback(const std::string& filepath)
 
     {
         ost::MutexLock m(toneMutex_);
-        delete audiofile_;
-        audiofile_ = NULL;
+        audiofile_.reset(0);
     }
 }
 
diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h
index f488a5a04f5c4860c968aae518629727df433baa..97f3c5714068bca4c6bd6a10911d045a56223474 100644
--- a/daemon/src/managerimpl.h
+++ b/daemon/src/managerimpl.h
@@ -97,7 +97,6 @@ class ManagerImpl {
         ManagerImpl();
         ~ManagerImpl();
 
-
         /**
          * General preferences configuration
          */
@@ -917,7 +916,7 @@ class ManagerImpl {
         /////////////////////
         ost::Mutex toneMutex_;
         std::auto_ptr<TelephoneTone> telephoneTone_;
-        AudioFile *audiofile_;
+        std::auto_ptr<AudioFile> audiofile_;
 
         // To handle volume control
         // short speakerVolume_;
@@ -1043,8 +1042,8 @@ class ManagerImpl {
         /**
          * Return a pointer to the instance of InstantMessaging
          */
-        sfl::InstantMessaging *getInstantMessageModule() {
-            return imModule_;
+        sfl::InstantMessaging &getInstantMessageModule() {
+            return *imModule_;
         }
 
         /**
@@ -1123,7 +1122,7 @@ class ManagerImpl {
          * Instant messaging module, resposible to initiate, format, parse,
          * send, and receive instant messages.
          */
-        sfl::InstantMessaging *imModule_;
+        std::auto_ptr<sfl::InstantMessaging> imModule_;
 };
 
 #endif // __MANAGER_H__
diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp
index 580ddaec4791cad62c48f6b9b76028561e06a6c7..16dc0bf124ed79ca74e8a1c391cd593695695e0e 100644
--- a/daemon/src/sip/sipvoiplink.cpp
+++ b/daemon/src/sip/sipvoiplink.cpp
@@ -37,7 +37,6 @@
 #endif
 
 #include "sipvoiplink.h"
-
 #include "manager.h"
 
 #include "sip/sdp.h"
@@ -675,7 +674,7 @@ Call *SIPVoIPLink::newOutgoingCall(const std::string& id, const std::string& toU
 
     SIPCall* call = new SIPCall(id, Call::OUTGOING, cp_);
 
-    // If toUri is not a well formated sip URI, use account information to process it
+    // If toUri is not a well formatted sip URI, use account information to process it
     std::string toUri;
 
     if (toUrl.find("sip:") != std::string::npos or
@@ -875,8 +874,10 @@ SIPVoIPLink::offhold(const std::string& id)
         call->setState(Call::ACTIVE);
 }
 
-void
-SIPVoIPLink::sendTextMessage(sfl::InstantMessaging *module, const std::string& callID, const std::string& message, const std::string& from)
+void SIPVoIPLink::sendTextMessage(sfl::InstantMessaging &module,
+                                  const std::string &callID,
+                                  const std::string &message,
+                                  const std::string &from)
 {
     SIPCall *call;
 
@@ -890,10 +891,8 @@ SIPVoIPLink::sendTextMessage(sfl::InstantMessaging *module, const std::string& c
     sfl::InstantMessaging::UriList list;
     sfl::InstantMessaging::UriEntry entry;
     entry[sfl::IM_XML_URI] = std::string("\"" + from + "\"");  // add double quotes for xml formating
-
     list.push_front(entry);
-
-    module->send_sip_message(call->inv, callID, module->appendUriList(message, list));
+    module.send_sip_message(call->inv, callID, module.appendUriList(message, list));
 }
 
 bool
@@ -1833,7 +1832,7 @@ void transaction_state_changed_cb(pjsip_inv_session *inv UNUSED, pjsip_transacti
 
     // Get the message inside the transaction
     pjsip_rx_data *r_data = e->body.tsx_state.src.rdata;
-    std::string formatedMessage = (char*) r_data->msg_info.msg->body->data;
+    std::string formattedMessage(static_cast<char*>(r_data->msg_info.msg->body->data));
 
     // Try to determine who is the recipient of the message
     SIPCall *call = static_cast<SIPCall *>(inv->mod_data[mod_ua_.id]);
@@ -1845,12 +1844,12 @@ void transaction_state_changed_cb(pjsip_inv_session *inv UNUSED, pjsip_transacti
     pjsip_dlg_create_response(inv->dlg, r_data, PJSIP_SC_OK, NULL, &t_data);
     pjsip_dlg_send_response(inv->dlg, tsx, t_data);
 
-    sfl::InstantMessaging *module = Manager::instance().getInstantMessageModule();
+    sfl::InstantMessaging &module = Manager::instance().getInstantMessageModule();
 
     try {
         // retreive the recipient-list of this message
-        std::string urilist = module->findTextUriList(formatedMessage);
-        sfl::InstantMessaging::UriList list = module->parseXmlUriList(urilist);
+        std::string urilist = module.findTextUriList(formattedMessage);
+        sfl::InstantMessaging::UriList list = module.parseXmlUriList(urilist);
 
         // If no item present in the list, peer is considered as the sender
         std::string from;
@@ -1868,7 +1867,7 @@ void transaction_state_changed_cb(pjsip_inv_session *inv UNUSED, pjsip_transacti
         if (from[0] == '<' && from[from.size()-1] == '>')
             from = from.substr(1, from.size()-2);
 
-        Manager::instance().incomingMessage(call->getCallId(), from, module->findTextMessage(formatedMessage));
+        Manager::instance().incomingMessage(call->getCallId(), from, module.findTextMessage(formattedMessage));
 
     } catch (const sfl::InstantMessageException &except) {
         ERROR("SipVoipLink: %s", except.what());
diff --git a/daemon/src/sip/sipvoiplink.h b/daemon/src/sip/sipvoiplink.h
index e43b91b03ddee34d09151338a3ff711a2f0c2afb..c40e8eb3bec09074f2d8109c9db33a3c634ba84e 100644
--- a/daemon/src/sip/sipvoiplink.h
+++ b/daemon/src/sip/sipvoiplink.h
@@ -275,7 +275,10 @@ class SIPVoIPLink : public VoIPLink {
          * @param The actual message to be transmitted
          * @param The sender of this message (could be another participant of a conference)
          */
-        void sendTextMessage(sfl::InstantMessaging *module, const std::string& callID, const std::string& message, const std::string& from);
+        void sendTextMessage(sfl::InstantMessaging &module,
+                             const std::string& callID,
+                             const std::string& message,
+                             const std::string& from);
 
         /**
          * Create the default UDP transport according ot Ip2Ip profile settings
diff --git a/daemon/src/voiplink.h b/daemon/src/voiplink.h
index 52257afd75300cd18bb07194652ce79382c77922..2df49ba924b609fb49b5c48aa689f8a1b368e1d7 100644
--- a/daemon/src/voiplink.h
+++ b/daemon/src/voiplink.h
@@ -50,7 +50,7 @@ typedef std::map<std::string, Call*> CallMap;
 
 class VoipLinkException : public std::runtime_error {
     public:
-        VoipLinkException(const std::string& str = "") :
+        VoipLinkException(const std::string &str = "") :
             std::runtime_error("UserAgent: VoipLinkException occured: " + str) {}
 };
 
@@ -93,7 +93,8 @@ class VoIPLink {
          * @param toUrl  The address of the recipient of the call
          * @return Call* The current call
          */
-        virtual Call* newOutgoingCall(const std::string& id, const std::string& toUrl) = 0;
+        virtual Call* newOutgoingCall(const std::string &id,
+                                      const std::string &toUrl) = 0;
 
         /**
          * Answer the call
@@ -105,34 +106,34 @@ class VoIPLink {
          * Hang up a call
          * @param id The call identifier
          */
-        virtual void hangup(const std::string& id) = 0;
+        virtual void hangup(const std::string &id) = 0;
 
         /**
         * Peer Hung up a call
         * @param id The call identifier
         */
-        virtual void peerHungup(const std::string& id) = 0;
+        virtual void peerHungup(const std::string &id) = 0;
 
         /**
          * Put a call on hold
          * @param id The call identifier
          * @return bool True on success
          */
-        virtual void onhold(const std::string& id) = 0;
+        virtual void onhold(const std::string &id) = 0;
 
         /**
          * Resume a call from hold state
          * @param id The call identifier
          * @return bool True on success
          */
-        virtual void offhold(const std::string& id) = 0;
+        virtual void offhold(const std::string &id) = 0;
 
         /**
          * Transfer a call to specified URI
          * @param id The call identifier
          * @param to The recipient of the call
          */
-        virtual void transfer(const std::string& id, const std::string& to) = 0;
+        virtual void transfer(const std::string &id, const std::string &to) = 0;
 
         /**
          * Attended transfer
@@ -146,14 +147,14 @@ class VoIPLink {
          * Refuse incoming call
          * @param id The call identifier
          */
-        virtual void refuse(const std::string& id) = 0;
+        virtual void refuse(const std::string &id) = 0;
 
         /**
          * Send DTMF
          * @param id The call identifier
          * @param code  The char code
          */
-        virtual void carryingDTMFdigits(const std::string& id, char code) = 0;
+        virtual void carryingDTMFdigits(const std::string &id, char code) = 0;
 
         /**
          * Return the codec protocol used for this call
@@ -169,7 +170,10 @@ class VoIPLink {
          * @param The actual message to be transmitted
          * @param The sender of this message (could be another participant of a conference)
          */
-        virtual void sendTextMessage(sfl::InstantMessaging *module, const std::string& callID, const std::string& message, const std::string& from) = 0;
+        virtual void sendTextMessage(sfl::InstantMessaging &module,
+                                     const std::string &callID,
+                                     const std::string &message,
+                                     const std::string &from) = 0;
 
         /** Add a call to the call map (protected by mutex)
          * @param call A call pointer with a unique pointer
@@ -182,7 +186,7 @@ class VoIPLink {
          * @param id A Call ID
          * @return Call*  Call pointer or 0
          */
-        Call* getCall(const std::string& id);
+        Call* getCall(const std::string &id);
 
     protected:
         /** Contains all the calls for this Link, protected by mutex */
@@ -194,7 +198,7 @@ class VoIPLink {
         /** Remove a call from the call map (protected by mutex)
          * @param id A Call ID
          */
-        void removeCall(const std::string& id);
+        void removeCall(const std::string &id);
 };
 
 #endif // __VOIP_LINK_H__