 
 (defun config-system/load-layers ()
   "Load all declared layers."
-  (config-system/load-layer-files '("funcs.el" "config.el"))
-  (config-system/read-packages-and-extensions)
-  (config-system/initialize-extensions config-system-all-pre-extensions t)
-  (config-system/install-packages)
+  (config-system//load-layer-files '("funcs.el" "config.el"))
+  (config-system//read-packages-and-extensions)
+  (config-system//sort-packages-and-extensions)
+  (config-system//initialize-extensions
+   config-system-all-pre-extensions-sorted t)
+  (config-system//install-packages)
   (spacemacs/append-to-buffer spacemacs-loading-text)
-  ;; restore warning level
+  ;; restore warning level before initialization
   (setq warning-minimum-level :warning)
-  (config-system/initialize-packages)
-  (config-system/initialize-extensions config-system-all-post-extensions)
-  (config-system/load-layer-files '("keybindings.el")))
-
-(defun config-system/load-layer-files (files)
+  (config-system//initialize-packages)
+  (config-system//initialize-extensions
+   config-system-all-post-extensions-sorted)
+  (config-system//load-layer-files '("keybindings.el")))
+
+(defun config-system//load-layer-files (files)
   "Load the files of list FILES from all declared layers."
   (dolist (layer (reverse config-system-config-layers))
     (let* ((sym (car layer))

          config-system-all-pre-extensions
          config-system-all-post-extensions)))

(defun config-system/read-packages-and-extensions ()
  "Load all packages and extensions declared in all layers and fill the
corresponding hash tables:
config-system-all-packages

                           (symbol-name layer) pkg)
                  (funcall init-func))))))

(defun config-system//initialize-pre-extension (ext layers)
  "Initialize the pre-extensions EXT from configuration layers LAYERS."
  (config-system//initialize-extension ext layers t))

(defun config-system//initialize-extensions (ext-list &optional pre)
  "Initialize all the declared extensions in EXT-LIST hash table.
If PRE is non nil then the extensions are pre-extensions."
  (let ((func (if pre 'config-system//initialize-pre-extension
                'config-system//initialize-extension))
        (hash (if pre config-system-all-pre-extensions
                config-system-all-post-extensions)))
    (mapc (lambda (x) (funcall func x (ht-get hash x))) ext-list)))

(defun config-system//initialize-extension (ext layers &optional pre)
  "Initialize the extension EXT from the configuration layers LAYERS.
If PRE is non nil then the extension is a pre-extensions."
  (dolist (layer layers)
