diff --git a/wally/config.py b/wally/config.py
index c760509..abc6bb0 100644
--- a/wally/config.py
+++ b/wally/config.py
@@ -13,8 +13,6 @@
 
 import pretty_yaml
 
-cfg_dict = {}
-
 
 class NoData(object):
     @classmethod
@@ -23,6 +21,10 @@
 
 
 class Config(object):
+    def __init__(self, val=None):
+        if val is not None:
+            self.update(val)
+
     def get(self, name, defval=None):
         obj = self.__dict__
         for cname in name.split("."):
@@ -32,14 +34,8 @@
             return defval
         return obj
 
-
-cfg = Config()
-cfg.__dict__ = cfg_dict
-
-
-def mkdirs_if_unxists(path):
-    if not os.path.exists(path):
-        os.makedirs(path)
+    def update(self, val):
+        self.__dict__.update(val)
 
 
 def get_test_files(results_dir):
@@ -55,71 +51,80 @@
         log_file='log.txt',
         sensor_storage='sensor_storage',
         nodes_report_file='nodes.yaml',
-        results='results',
+        results_storage='results',
         hwinfo_directory='hwinfo',
         hwreport_fname='hwinfo.txt',
         raw_results='raw_results.yaml')
 
     res = dict((k, in_var_dir(v)) for k, v in res.items())
-    res['var_dir'] = results_dir
+    res['results_dir'] = results_dir
     return res
 
 
-def load_config(file_name, explicit_folder=None):
-    cfg_dict.update(yaml.load(open(file_name).read()))
+def load_config(file_name):
+    file_name = os.path.abspath(file_name)
 
-    var_dir = cfg_dict.get('internal', {}).get('var_dir_root', '/tmp')
-    run_uuid = None
+    defaults = dict(
+        sensors_remote_path='/tmp/sensors',
+        testnode_log_root='/tmp/wally',
+        settings={}
+    )
 
-    if explicit_folder is None:
+    raw_cfg = yaml.load(open(file_name).read())
+    raw_cfg['config_folder'] = os.path.dirname(file_name)
+    if 'include' in raw_cfg:
+        default_path = os.path.join(raw_cfg['config_folder'],
+                                    raw_cfg.pop('include'))
+        default_cfg = yaml.load(open(default_path).read())
+
+        # TODO: Need more intelectual configs merge?
+        default_cfg.update(raw_cfg)
+        raw_cfg = default_cfg
+
+    cfg = Config(defaults)
+    cfg.update(raw_cfg)
+
+    results_storage = cfg.settings.get('results_storage', '/tmp')
+    results_storage = os.path.abspath(results_storage)
+
+    existing = file_name.startswith(results_storage)
+
+    if existing:
+        cfg.results_dir = os.path.dirname(file_name)
+        cfg.run_uuid = os.path.basename(cfg.results_dir)
+    else:
+        # genarate result folder name
         for i in range(10):
-            run_uuid = pet_generate(2, "_")
-            results_dir = os.path.join(var_dir, run_uuid)
-            if not os.path.exists(results_dir):
+            cfg.run_uuid = pet_generate(2, "_")
+            cfg.results_dir = os.path.join(results_storage,
+                                           cfg.run_uuid)
+            if not os.path.exists(cfg.results_dir):
                 break
         else:
-            run_uuid = str(uuid.uuid4())
-            results_dir = os.path.join(var_dir, run_uuid)
-        cfg_dict['run_uuid'] = run_uuid.replace('_', '-')
-    else:
-        if not os.path.isdir(explicit_folder):
-            ex2 = os.path.join(var_dir, explicit_folder)
-            if os.path.isdir(ex2):
-                explicit_folder = ex2
-            else:
-                raise RuntimeError("No such directory " + explicit_folder)
+            cfg.run_uuid = str(uuid.uuid4())
+            cfg.results_dir = os.path.join(results_storage,
+                                           cfg.run_uuid)
 
-        results_dir = explicit_folder
+    # setup all files paths
+    cfg.update(get_test_files(cfg.results_dir))
 
-    cfg_dict.update(get_test_files(results_dir))
-    mkdirs_if_unxists(cfg_dict['var_dir'])
+    if existing:
+        cfg.update(load_run_params(cfg.run_params_file))
 
-    if explicit_folder is not None:
-        cfg_dict.update(load_run_params(cfg_dict['run_params_file']))
-        run_uuid = cfg_dict['run_uuid']
-
-    mkdirs_if_unxists(cfg_dict['sensor_storage'])
-
-    if 'sensors_remote_path' not in cfg_dict:
-        cfg_dict['sensors_remote_path'] = '/tmp/sensors'
-
-    testnode_log_root = cfg_dict.get('testnode_log_root', '/var/wally')
+    testnode_log_root = cfg.get('testnode_log_root')
     testnode_log_dir = os.path.join(testnode_log_root, "{0}/{{name}}")
-    cfg_dict['default_test_local_folder'] = \
-        testnode_log_dir.format(cfg_dict['run_uuid'])
+    cfg.default_test_local_folder = testnode_log_dir.format(cfg.run_uuid)
 
-    mkdirs_if_unxists(cfg_dict['results'])
-    mkdirs_if_unxists(cfg_dict['hwinfo_directory'])
-
-    return results_dir
+    return cfg
 
 
-def save_run_params():
+def save_run_params(cfg):
     params = {
-        'comment': cfg_dict['comment'],
-        'run_uuid': cfg_dict['run_uuid']
+        'comment': cfg.comment,
+        'run_uuid': cfg.run_uuid
     }
-    with open(cfg_dict['run_params_file'], 'w') as fd:
+
+    with open(cfg.run_params_file, 'w') as fd:
         fd.write(pretty_yaml.dumps(params))
 
 
