diff --git a/encode.m b/encode.m
index b912345b9bbd000452fe8bfa4cdaf304ae5f0452..5a504018cfe5aa662ca17678ffc138663269241f 100644
--- a/encode.m
+++ b/encode.m
@@ -1,32 +1,32 @@
-function  encode(ConfigFile,varargin)
+function  encode(varargin)
 %ENCODE Summary of this function goes here
 %   Detailed explanation goes here
 
 [HEVCDir,~,~] = fileparts(mfilename('fullpath'));
 TAppEncoder = fullfile(HEVCDir,'bin','TAppEncoder.exe');
-ConfigFile = fullfile(HEVCDir,'cfg',ConfigFile);
-
-p = inputParser; p.KeepUnmatched = true;
-
-p.addRequired ('ConfigFile'                  ,@ischar);
-p.addParameter('InputFile'        ,'ref.yuv' ,@ischar);
-p.addParameter('BitstreamFile'    ,'str.hevc',@ischar);
-p.addParameter('ReconFile'        ,'rec.yuv' ,@ischar);
-p.addParameter('LogFile'          ,'log.rtf' ,@ischar);
-p.addParameter('SourceWidth'      ,'512'     ,@ischar);
-p.addParameter('SourceHeight'     ,'512'     ,@ischar);
-p.addParameter('InputBitDepth'    ,'8'       ,@ischar);
-p.addParameter('InputChromaFormat','420'     ,@ischar);
-p.addParameter('FrameRate'        ,'60'      ,@ischar);
-p.addParameter('FrameSkip'        ,'0'       ,@ischar);
-p.addParameter('FramesToBeEncoded','1'       ,@ischar);
-p.addParameter('QP'               ,'32'      ,@ischar);
+
+p = inputParser; p.KeepUnmatched = true; p.StructExpand = true;
+
+p.addParameter('ConfigFile'       ,'Intra.cfg',@ischar);
+p.addParameter('InputFile'        ,'ref.yuv'  ,@ischar);
+p.addParameter('BitstreamFile'    ,'str.hevc' ,@ischar);
+p.addParameter('ReconFile'        ,'rec.yuv'  ,@ischar);
+p.addParameter('LogFile'          ,'log.rtf'  ,@ischar);
+p.addParameter('SourceWidth'      ,'512'      ,@ischar);
+p.addParameter('SourceHeight'     ,'512'      ,@ischar);
+p.addParameter('InputBitDepth'    ,'8'        ,@ischar);
+p.addParameter('InputChromaFormat','420'      ,@ischar);
+p.addParameter('FrameRate'        ,'60'       ,@ischar);
+p.addParameter('FrameSkip'        ,'0'        ,@ischar);
+p.addParameter('FramesToBeEncoded','1'        ,@ischar);
+p.addParameter('QP'               ,'32'       ,@ischar);
 % Add additional parameters here
 
-p.parse(ConfigFile,varargin{:});
+p.parse(varargin{:});
 
 parameters = fieldnames (p.Results);
 values     = struct2cell(p.Results);
+
 extraParameters = fieldnames (p.Unmatched);
 extraValues     = struct2cell(p.Unmatched);
 
@@ -46,6 +46,8 @@ end
         indLog  = cellfun(@(str) strcmp(str,'LogFile'),parameters);
         ind     = indConf|indLog;
         
+        values{indConf} = fullfile(HEVCDir,'cfg',values{indConf}); 
+
         argConf = strjoin(['-c',values(indConf)]);
         argLog  = strjoin(['>' ,values(indLog) ]);
         argList = cellfun(@(param,val) ['--',param,'=',val],...