diff --git a/CustomModels/messagemodel.cpp b/CustomModels/messagemodel.cpp
index 36aa0520958f67ea31d580f415923b3b27028d56..dc15ebb6c0b8ba830d68633eb3051dcbf7aa55fb 100644
--- a/CustomModels/messagemodel.cpp
+++ b/CustomModels/messagemodel.cpp
@@ -157,7 +157,7 @@ QString MessagesModel::getCurrent() const
 
 void MessagesModel::setCurrent( const QString &value )
 {
-    QMutexLocker( &this->mutex );
+    //QMutexLocker( &this->mutex );
     current = value;
     beginResetModel();
 
@@ -165,7 +165,7 @@ void MessagesModel::setCurrent( const QString &value )
         messagesOfCurrentChannel = mChannelMap[value]->getMessageRepo()->timestampIndex().values().toVector();
         duplicateCheck.clear();
 
-        for ( auto currentMessage : messagesOfCurrentChannel ) {
+        for ( const auto &currentMessage : messagesOfCurrentChannel ) {
             duplicateCheck.insert( currentMessage->getId() );
         }
     } else {
@@ -262,7 +262,7 @@ QHash<int, QByteArray> MessagesModel::roleNames() const
 
 void MessagesModel::onNewMessage( const QSharedPointer<RocketChatChannel> &channel, qint64 timestamp )
 {
-    QMutexLocker( &this->mutex );
+    //QMutexLocker( &this->mutex );
 
     if ( timestamp == 0 ) {
         setCurrent( current );
diff --git a/CustomModels/usermodel.cpp b/CustomModels/usermodel.cpp
index 56c3e56deef72566d3ab86005d7e1809816fe049..ebd8fa422ad5ec5bce2e358401f877b8884637de 100644
--- a/CustomModels/usermodel.cpp
+++ b/CustomModels/usermodel.cpp
@@ -151,7 +151,7 @@ void UserModel::setCurrent( const QString &value )
     QList<QSharedPointer<RocketChatUser>> userList = userMap.values( value );
     mMutex.unlock();
 
-    for ( auto current : userList ) {
+    for ( const auto &current : userList ) {
         userOfCurrentChannel.insert( current->getUserId(), current );
     }
 
diff --git a/api/meteorddp.cpp b/api/meteorddp.cpp
index 35f0ff54493204df0ff0aa144a7a15db74f4237a..57e0c6215ef9a6ff5aac5b9a668e301f737f30df 100755
--- a/api/meteorddp.cpp
+++ b/api/meteorddp.cpp
@@ -42,6 +42,7 @@ void MeteorDDP::init( const QString &pUri, bool pUnsecure )
 
     QString protocol = QStringLiteral( "wss://" );
     unsecure = pUnsecure;
+
     if ( pUnsecure ) {
         protocol = QStringLiteral( "ws://" );
     }
@@ -65,14 +66,14 @@ void MeteorDDP::init( const QString &pUri, bool pUnsecure )
     mLastPing = currentTime;
 }
 
-void MeteorDDP::registerMessageHandler(MessageListener &listener)
+void MeteorDDP::registerMessageHandler( MessageListener &listener )
 {
-    connect(this, &MeteorDDP::messageReceived , &listener, &MessageListener::handlesMessage);
+    connect( this, &MeteorDDP::messageReceived, &listener, &MessageListener::handlesMessage );
 }
 
-void MeteorDDP::registerMessageHandler(MessageListener *listener)
+void MeteorDDP::registerMessageHandler( MessageListener *listener )
 {
-    connect(this, &MeteorDDP::messageReceived , listener, &MessageListener::handlesMessage);
+    connect( this, &MeteorDDP::messageReceived, listener, &MessageListener::handlesMessage );
 }
 
 void MeteorDDP::connectWithServer()
@@ -249,7 +250,7 @@ void MeteorDDP::resume()
             mWsClient->open( wsUri );
         } else if ( !mWsClient->isConnecting() ) {
             QMetaObject::Connection *const connection = new QMetaObject::Connection;
-            *connection = connect( mWsClient, &Websocket::closed, [&]() {
+            *connection = connect( mWsClient, &Websocket::closed, [ = ]() {
                 qDebug() << "websocket closed";
                 mWsClient->open( wsUri );
                 QDateTime now = QDateTime::currentDateTime();
diff --git a/rocketchatserver.cpp b/rocketchatserver.cpp
index ac6e4eea70a7820f34a7b7954e6f7adb9deac005..54364797c490d0b061fc70ea67187621d4e9b503 100755
--- a/rocketchatserver.cpp
+++ b/rocketchatserver.cpp
@@ -201,6 +201,7 @@ void RocketChatServerData::loadEmojis()
 
         if ( !emojisByCategory.contains( category ) ) {
             emojisByCategory.insert( category, QList<QSharedPointer<Emoji>>() );
+            emojisByCategory[category].reserve( 500 );
         }
 
         emojisByCategory[category].append( emoji );
@@ -208,7 +209,7 @@ void RocketChatServerData::loadEmojis()
 
     auto keys = emojisByCategory.keys();
 
-    for ( auto key : keys ) {
+    for ( const auto &key : keys ) {
         QMetaObject::invokeMethod( emojiModel, "addEmojisByCategory", Q_ARG( QString, key ), Q_ARG( QList<QSharedPointer<Emoji>>, emojisByCategory[key] ) );
     }
 }
diff --git a/services/rocketchatchannelservice.cpp b/services/rocketchatchannelservice.cpp
index e57afc42586c36ee1eb7f5da69a30a2168acc663..97aa80605a6464802757e533255bdcb0f05410ff 100755
--- a/services/rocketchatchannelservice.cpp
+++ b/services/rocketchatchannelservice.cpp
@@ -226,10 +226,10 @@ void RocketChatChannelService::loadJoinedChannelsFromServer( void )
 
             auto channelsLocal = mChannels->getElements();
 
-            for ( auto channelKey : channelsLocal.keys() ) {
+            for ( const auto &channelKey : channelsLocal.keys() ) {
                 bool deleteFlag = true;
 
-                for ( auto channelServer : channelsParsed ) {
+                for ( const auto &channelServer : channelsParsed ) {
                     if ( channelServer->getRoomId() == channelKey ) {
                         deleteFlag = false;
                     }
@@ -603,7 +603,7 @@ channelVector RocketChatChannelService::searchRoomLocal( const QString &pTerm, c
     channelVector list;
     QString term = pTerm.toLower();
 
-    for ( auto channel : mChannels->getElements() ) {
+    for ( const auto &channel : mChannels->getElements() ) {
         QString id = channel->getRoomId();
         QString type = channel->getType();
         QString name = channel->getName().toLower();
diff --git a/utils.cpp b/utils.cpp
index 95ee297f9a1dff8296152a873a4c7b4d17b2586c..3b3c4c35a576f95cb94cf491a8b80ae283a7de34 100755
--- a/utils.cpp
+++ b/utils.cpp
@@ -154,7 +154,7 @@ QString Utils::linkiFy( const QString &pText )
 
         parts.append( pText.right( pText.length() - idx_last ) );
 
-        for ( const auto part : parts ) {
+        for ( const auto &part : parts ) {
             html += part;
         }