diff --git a/bin/cdist-config b/bin/cdist-config
index f7fb5ac0..de21d717 100644
--- a/bin/cdist-config
+++ b/bin/cdist-config
@@ -111,6 +111,7 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")
 : ${__cdist_local_base_cache_dir:=$__cdist_abs_mydir/../$__cdist_name_cache}
 
 : ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"}
+: ${__cdist_core_dir:="$(cd "$__cdist_abs_mydir/../core" && pwd -P)"}
 
 : ${__cdist_explorer_dir:=$__cdist_conf_dir/$__cdist_name_explorer}
 : ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest}
@@ -149,6 +150,15 @@ __cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")
 ################################################################################
 # Internal functions
 #
+
+# *NEW* Load functions from library
+for __cdist_lib in $__cdist_core_dir/*; do
+   echo Loading $__cdist_lib ...
+   . "$__cdist_lib"
+done
+
+exit 0
+
 __cdist_echo()
 {
    __cdist_echo_type="$1"; shift
@@ -208,6 +218,11 @@ __cdist_usage()
    __cdist_exit_err "$__cdist_myname: $@"
 }
 
+___cdist_lib_path()
+{
+   echo $_
+}
+
 __cdist_init_deploy()
 {
    __cdist_echo info "Creating clean directory structure "
diff --git a/core/__cdist_dir b/core/__cdist_dir
index 0d30e14a..7799d03e 100755
--- a/core/__cdist_dir
+++ b/core/__cdist_dir
@@ -24,28 +24,30 @@
 #
 
 
-. cdist-config
-[ $# -eq 4 ] || __cdist_usage "<push|pull> <target host> <src dir> <dst dir>"
-set -ue
+__cdist_dir()
+{
+   [ $# -eq 4 ] || __cdist_usage "<push|pull> <target host> <src dir> <dst dir>"
+   set -ue
 
-__cdist_action="$1"; shift
-__cdist_target_host="$1"; shift
-__cdist_src_dir="$1"; shift
-__cdist_dst_dir="$1"; shift
+   __cdist_action="$1"; shift
+   __cdist_target_host="$1"; shift
+   __cdist_src_dir="$1"; shift
+   __cdist_dst_dir="$1"; shift
 
-# This will be the destination directory, so no subdirectories
-# of the same name are created, if the directory is already existing
-__cdist_top_dir="${__cdist_dst_dir%/*}"
+   # This will be the destination directory, so no subdirectories
+   # of the same name are created, if the directory is already existing
+   __cdist_top_dir="${__cdist_dst_dir%/*}"
 
-if [ "$__cdist_action" = "push" ]; then
-   ssh "${__cdist_remote_user}@${__cdist_target_host}" \
-      "mkdir -p \"${__cdist_dst_dir}\""
-   scp -qr "$__cdist_src_dir" \
-      "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_top_dir}"
-elif [ "$__cdist_action" = "pull" ]; then
-   mkdir -p "${__cdist_dst_dir}"
-   scp -qr "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_src_dir}" \
-      "${__cdist_top_dir}"
-else
-   __cdist_exit_err "Unknown action $__cdist_action"
-fi
+   if [ "$__cdist_action" = "push" ]; then
+      ssh "${__cdist_remote_user}@${__cdist_target_host}" \
+         "mkdir -p \"${__cdist_dst_dir}\""
+      scp -qr "$__cdist_src_dir" \
+         "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_top_dir}"
+   elif [ "$__cdist_action" = "pull" ]; then
+      mkdir -p "${__cdist_dst_dir}"
+      scp -qr "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_src_dir}" \
+         "${__cdist_top_dir}"
+   else
+      __cdist_exit_err "Unknown action $__cdist_action"
+   fi
+}