diff --git a/core/Controllers/CoreController.php b/core/Controllers/CoreController.php
index 134d72b17f902fff1e3f0b87faa2b9cdf8dad6b7..d4f8eeb0b418b85b641a4df4e9403a850e7f5f16 100644
--- a/core/Controllers/CoreController.php
+++ b/core/Controllers/CoreController.php
@@ -15,47 +15,30 @@
 
 namespace Core\Controllers;
 
+use Core\Models\CoreConfigModel;
 use Psr\Http\Message\RequestInterface;
 use Psr\Http\Message\ResponseInterface;
 use Respect\Validation\Validator;
 use Core\Models\ServiceModel;
 
-include_once 'core/class/class_portal.php';
-
 class CoreController
 {
     public function initialize(RequestInterface $request, ResponseInterface $response)
     {
-        $data = $request->getParams();
+        $customId = CoreConfigModel::getCustomId();
 
-        $availableLanguages = ['en', 'fr'];
+        $data = $request->getParams();
 
         $aInit = [];
-        $aInit['lang'] = 'en';
         $aInit['coreUrl'] = str_replace('rest/', '', \Url::coreurl());
-        $aInit['applicationName'] = $_SESSION['config']['applicationname']; //Todo No Session
+        $aInit['applicationName'] = CoreConfigModel::getApplicationName();
+        $aInit['lang'] = CoreConfigModel::getLanguage();
 
         if (!empty($data['views'])) {
             foreach ($data['views'] as $view) {
                 $aInit[$view . 'View'] = 'Views/' . $view . '.component.html';
-                if(file_exists("{$_SESSION['config']['corepath']}custom/{$_SESSION['custom_override_id']}/apps/maarch_entreprise/Views/{$view}.component.html")) {
-                    $aInit[$view . 'View'] = "../../custom/{$_SESSION['custom_override_id']}/apps/maarch_entreprise/Views/{$view}.component.html";
-                }
-            }
-        }
-
-        if (file_exists("custom/{$_SESSION['custom_override_id']}/apps/maarch_entreprise/xml/config.xml")) { //Todo No Session
-            $path = "custom/{$_SESSION['custom_override_id']}/apps/maarch_entreprise/xml/config.xml";
-        } else {
-            $path = 'apps/maarch_entreprise/xml/config.xml';
-        }
-
-        if (file_exists($path)) {
-            $loadedXml = simplexml_load_file($path);
-            if ($loadedXml) {
-                $lang = (string)$loadedXml->CONFIG->lang;
-                if (in_array($lang, $availableLanguages)) {
-                    $aInit['lang'] = $lang;
+                if(file_exists("custom/{$customId}/apps/maarch_entreprise/Views/{$view}.component.html")) {
+                    $aInit[$view . 'View'] = "../../custom/{$customId}/apps/maarch_entreprise/Views/{$view}.component.html";
                 }
             }
         }
diff --git a/core/Controllers/ParametersController.php b/core/Controllers/ParametersController.php
index d7e5c16bb2e7f4dff7930ceca095cc17eda1a08a..fd7a879899674a860c18779a26b187f7bd0c2067 100644
--- a/core/Controllers/ParametersController.php
+++ b/core/Controllers/ParametersController.php
@@ -17,9 +17,6 @@ use Respect\Validation\Validator;
 use Core\Models\LangModel;
 use Core\Models\ParametersModel;
 
-require_once 'core/class/class_db_pdo.php';
-require_once 'modules/notes/Models/NoteModel.php';
-
 class ParametersController
 {
     public function getParametersForAdministration(RequestInterface $request, ResponseInterface $response)
diff --git a/core/Controllers/UserController.php b/core/Controllers/UserController.php
index 3a4a677cf5064696bde3cb0c4116c6ba796e24cc..0c3eb6dd1096e92a4dbb130aa7bdad21593efdde 100644
--- a/core/Controllers/UserController.php
+++ b/core/Controllers/UserController.php
@@ -446,26 +446,12 @@ class UserController
 
     public function getUsersForAutocompletion(RequestInterface $request, ResponseInterface $response)
     {
-        $users = UserModel::get([
-            'select'    => ['user_id', 'firstname', 'lastname'],
-            'where'     => ['enabled = ?', 'status != ?', 'user_id != ?'],
-            'data'      => ['Y', 'DEL', 'superadmin']
-        ]);
+        $excludedUsers = ['superadmin'];
 
-        foreach ($users as $key => $value) {
-            $users[$key]['formattedUser'] = "{$value['firstname']} {$value['lastname']} ({$value['user_id']})";
-        }
-
-        return $response->withJson($users);
-    }
-
-    public function getUsersForAutocompletionWithExclusion(RequestInterface $request, ResponseInterface $response, $aArgs)
-    {
-        $excludeUsers = ['superadmin',$aArgs['userId']];
         $users = UserModel::get([
             'select'    => ['user_id', 'firstname', 'lastname'],
             'where'     => ['enabled = ?', 'status != ?', 'user_id not in (?)'],
-            'data'      => ['Y', 'DEL', $excludeUsers]
+            'data'      => ['Y', 'DEL', $excludedUsers]
         ]);
 
         foreach ($users as $key => $value) {
diff --git a/core/Models/CoreConfigModel.php b/core/Models/CoreConfigModel.php
new file mode 100644
index 0000000000000000000000000000000000000000..878e64e164f4f9d7c1e70bbb5a9af4dbd22bb5f2
--- /dev/null
+++ b/core/Models/CoreConfigModel.php
@@ -0,0 +1,87 @@
+<?php
+
+/**
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
+*
+*/
+
+/**
+* @brief Core Config Model
+* @author dev@maarch.org
+* @ingroup core
+*/
+
+namespace Core\Models;
+
+//This model is not customizable
+class CoreConfigModel
+{
+    public static function getCustomId()
+    {
+        if (!file_exists('custom/custom.xml')) {
+            return '';
+        }
+
+        $explodeUrl = explode('/', $_SERVER['SCRIPT_NAME']);
+        $path = $explodeUrl[count($explodeUrl) - 3];
+
+        $xmlfile = simplexml_load_file('custom/custom.xml');
+        foreach ($xmlfile->custom as $value) {
+            if (!empty($value->path) && $value->path == $path) {
+                return (string)$value->custom_id;
+            } elseif($value->ip == $_SERVER['SERVER_ADDR']) {
+                return (string)$value->custom_id;
+            } else if ($value->external_domain == $_SERVER['HTTP_HOST'] || $value->domain == $_SERVER['HTTP_HOST']) {
+                return (string)$value->custom_id;
+            }
+        }
+
+        return '';
+    }
+
+    public static function getApplicationName()
+    {
+        $customId = CoreConfigModel::getCustomId();
+
+        if (file_exists("custom/{$customId}/apps/maarch_entreprise/xml/config.xml")) {
+            $path = "custom/{$customId}/apps/maarch_entreprise/xml/config.xml";
+        } else {
+            $path = 'apps/maarch_entreprise/xml/config.xml';
+        }
+
+        if (file_exists($path)) {
+            $loadedXml = simplexml_load_file($path);
+            if ($loadedXml) {
+                return (string)$loadedXml->CONFIG->applicationname;
+            }
+        }
+
+        return 'Maarch Courrier';
+    }
+
+    public static function getLanguage()
+    {
+        $availableLanguages = ['en', 'fr'];
+        $customId = CoreConfigModel::getCustomId();
+
+        if (file_exists("custom/{$customId}/apps/maarch_entreprise/xml/config.xml")) {
+            $path = "custom/{$customId}/apps/maarch_entreprise/xml/config.xml";
+        } else {
+            $path = 'apps/maarch_entreprise/xml/config.xml';
+        }
+
+        if (file_exists($path)) {
+            $loadedXml = simplexml_load_file($path);
+            if ($loadedXml) {
+                $lang = (string)$loadedXml->CONFIG->lang;
+                if (in_array($lang, $availableLanguages)) {
+                    return $lang;
+                }
+            }
+        }
+
+        return 'en';
+    }
+}
diff --git a/core/Models/SecurityModelAbstract.php b/core/Models/SecurityModelAbstract.php
index e3244504e8f03ed9e29f6316bfcf3dffa33e1179..07d9d8a1d91ec117b3c0fc064113db6d442592ab 100644
--- a/core/Models/SecurityModelAbstract.php
+++ b/core/Models/SecurityModelAbstract.php
@@ -43,9 +43,10 @@ class SecurityModelAbstract
         ValidatorModel::notEmpty($args, ['userId', 'password']);
         ValidatorModel::stringType($args, ['userId', 'password']);
 
+        $customId = CoreConfigModel::getCustomId();
 
-        if (file_exists("custom/{$_SESSION['custom_override_id']}/apps/maarch_entreprise/xml/config.xml")) { //Todo No Session
-            $path = "custom/{$_SESSION['custom_override_id']}/apps/maarch_entreprise/xml/config.xml";
+        if (file_exists("custom/{$customId}/apps/maarch_entreprise/xml/config.xml")) {
+            $path = "custom/{$customId}/apps/maarch_entreprise/xml/config.xml";
         } else {
             $path = 'apps/maarch_entreprise/xml/config.xml';
         }
@@ -58,13 +59,11 @@ class SecurityModelAbstract
             }
         }
 
-        $t = str_replace('core/Models', '', dirname(__file__));
-        $y = basename($t);
-
+        $cookiePath = str_replace('apps/maarch_entreprise/index.php', '', $_SERVER['SCRIPT_NAME']);
 
         $cookieData = json_encode(['userId' => $args['userId'], 'password' => $args['password']]);
         $cookieDataEncrypted = openssl_encrypt ($cookieData, 'aes-256-ctr', '12345678910');
-        setcookie('maarchCourrierAuth', base64_encode($cookieDataEncrypted), time() + 60 * $cookieTime, '/', '', false, true);
+        setcookie('maarchCourrierAuth', base64_encode($cookieDataEncrypted), time() + 60 * $cookieTime, $cookiePath, '', false, true);
 
         return true;
     }
diff --git a/modules/attachments/Controllers/AttachmentsController.php b/modules/attachments/Controllers/AttachmentsController.php
index 125065e62ae888b53365b76b052c9a0fb27a1e01..e0f1d75710f6676d986791a484f2776eeff018ba 100644
--- a/modules/attachments/Controllers/AttachmentsController.php
+++ b/modules/attachments/Controllers/AttachmentsController.php
@@ -21,8 +21,6 @@ use Respect\Validation\Validator;
 use Attachments\Models\AttachmentsModel;
 use Core\Controllers\ResController;
 
-require_once 'modules/attachments/Models/AttachmentsModel.php';
-
 class AttachmentsController
 {
     
diff --git a/modules/attachments/Models/AttachmentsModelAbstract.php b/modules/attachments/Models/AttachmentsModelAbstract.php
index 379bc6941baeb5ebc747f6b0ee8c471ccee961fa..babfb7104a4a08fc533746adfdc7b2b634d225bc 100644
--- a/modules/attachments/Models/AttachmentsModelAbstract.php
+++ b/modules/attachments/Models/AttachmentsModelAbstract.php
@@ -9,6 +9,7 @@
 
 namespace Attachments\Models;
 
+use Core\Models\CoreConfigModel;
 use Core\Models\DatabaseModel;
 use Core\Models\ValidatorModel;
 
@@ -16,8 +17,10 @@ class AttachmentsModelAbstract
 {
     public static function getAttachmentsTypesByXML()
     {
-        if (file_exists('custom/' .$_SESSION['custom_override_id']. '/apps/maarch_entreprise/xml/entreprise.xml')) {
-            $path = 'custom/' .$_SESSION['custom_override_id']. '/apps/maarch_entreprise/xml/entreprise.xml';
+        $customId = CoreConfigModel::getCustomId();
+
+        if (file_exists("custom/{$customId}/apps/maarch_entreprise/xml/entreprise.xml")) {
+            $path = "custom/{$customId}/apps/maarch_entreprise/xml/entreprise.xml";
         } else {
             $path = 'apps/maarch_entreprise/xml/entreprise.xml';
         }
diff --git a/modules/visa/Controllers/VisaController.php b/modules/visa/Controllers/VisaController.php
index 8b9b2259d0e1b9ad561d93450162e326d4db3dd0..c61dccb4e08e00358262a5159bde0a1e7cb65921 100644
--- a/modules/visa/Controllers/VisaController.php
+++ b/modules/visa/Controllers/VisaController.php
@@ -26,6 +26,7 @@ use Psr\Http\Message\RequestInterface;
 use Psr\Http\Message\ResponseInterface;
 use Visa\Models\VisaModel;
 
+//TODO Require once
 require_once 'modules/basket/class/class_modules_tools.php';
 require_once 'core/class/class_core_tools.php';
 require_once 'core/class/class_security.php';
diff --git a/rest/index.php b/rest/index.php
index cdaec5d77d6cc6b1f3c8719fd947086b82ab1c3d..59424fb1384d361515cf7f189b3b115c8210e5f9 100644
--- a/rest/index.php
+++ b/rest/index.php
@@ -161,7 +161,6 @@ $app->post('/resExt', \Core\Controllers\ResExtController::class . ':create');
 
 //Users
 $app->get('/users/autocompleter', \Core\Controllers\UserController::class . ':getUsersForAutocompletion');
-$app->get('/users/autocompleter/exclude/{userId}', \Core\Controllers\UserController::class . ':getUsersForAutocompletionWithExclusion');
 $app->get('/users/profile', \Core\Controllers\UserController::class . ':getCurrentUserInfos');
 $app->put('/users/profile', \Core\Controllers\UserController::class . ':updateProfile');
 $app->post('/users', \Core\Controllers\UserController::class . ':create');