Index: source/python/classes/ControlFile.py
===================================================================
--- source/python/classes/ControlFile.py	(revision 0e576fcaf0dab8e7e586efa1a4b9b194ee90f8bb)
+++ source/python/classes/ControlFile.py	(revision 70fee58eedd41328d9f5cdc56db77e03ec78bf71)
@@ -60,5 +60,5 @@
 sys.path.append('../')
 import _config
-from mods.tools import my_error
+from mods.tools import my_error, silent_remove
 
 # ------------------------------------------------------------------------------
@@ -188,9 +188,9 @@
 
         try:
-            with open(os.path.join(_config.PATH_CONTROLFILES,
-                                   self.controlfile)) as f:
+            cfile = os.path.join(_config.PATH_CONTROLFILES, self.controlfile)
+            with open(cfile) as f:
                 fdata = f.read().split('\n')
         except IOError:
-            print('Could not read CONTROL file "' + args.controlfile + '"')
+            print('Could not read CONTROL file "' + cfile + '"')
             print('Either it does not exist or its syntax is wrong.')
             print('Try "' + sys.argv[0].split('/')[-1] + \
@@ -450,5 +450,5 @@
                 self.mailops = [self.mailops]
 
-        if queue in ['ecgate', 'cca'] and \
+        if queue in _config.QUEUES_LIST and \
            not self.gateway or not self.destination or \
            not self.ecuid or not self.ecgid:
@@ -463,5 +463,5 @@
                                     _config.FILE_MARS_REQUESTS)
             if os.path.isfile(marsfile):
-                os.remove(marsfile)
+                silent_remove(marsfile)
 
         # check all logical variables for data type
Index: source/python/classes/EcFlexpart.py
===================================================================
--- source/python/classes/EcFlexpart.py	(revision aa275fc4792ca811bc736b50dc19cfaa39702922)
+++ source/python/classes/EcFlexpart.py	(revision 70fee58eedd41328d9f5cdc56db77e03ec78bf71)
@@ -85,5 +85,5 @@
                      codes_get_values, codes_set_values, codes_set,
                      codes_write, codes_release, codes_new_from_index,
-                     codes_index_release)
+                     codes_index_release, codes_index_get)
 
 # software specific classes and modules from flex_extract
@@ -136,5 +136,6 @@
         self.types = dict()
 
-        if c.maxstep > len(c.type):    # Pure forecast mode
+        # Pure forecast mode
+        if c.maxstep > len(c.type) and 'AN' not in c.type:
             c.type = [c.type[0]]
             c.step = ['{:0>3}'.format(int(c.step[0]))]
@@ -168,9 +169,7 @@
                     btlist = [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0]
 
-                if ((ty.upper() == 'AN' and
-                     int(c.time[i]) % int(c.dtime) ==0) or
-                    (ty.upper() != 'AN' and
-                     int(c.step[i]) % int(c.dtime) == 0 and
-                     int(c.step[i]) % int(c.dtime) == 0) ) and \
+                if ((ty.upper() == 'AN' and (int(c.time[i]) % int(c.dtime)) == 0) or
+                    (ty.upper() != 'AN' and (int(c.step[i]) % int(c.dtime)) == 0 and
+                     (int(c.step[i]) % int(c.dtime) == 0)) ) and \
                     (int(c.time[i]) in btlist or c.maxstep > 24):
 
@@ -434,5 +433,5 @@
             #index_vals.append(grib_index_get(iid, key))
             #print(index_vals[-1])
-            key_vals = grib_index_get(iid, key)
+            key_vals = codes_index_get(iid, key)
             print(key_vals)
             # have to sort the steps for disaggregation,
@@ -532,5 +531,5 @@
                 if isinstance(pv, str):
                     continue
-                retr_param_dict['type'] = '' + ftype
+                retr_param_dict['type'] = ftype
                 retr_param_dict['time'] = self.types[ftype]['times']
                 retr_param_dict['step'] = self.types[ftype]['steps']
@@ -538,5 +537,6 @@
                 retr_param_dict['stream'] = self.stream
                 retr_param_dict['target'] = \
-                    self._mk_targetname(ftype, pk,
+                    self._mk_targetname(ftype,
+                                        pk,
                                         retr_param_dict['date'].split('/')[0])
                 retr_param_dict['param'] = pv[0]
@@ -689,5 +689,5 @@
 
         loader = TemplateLoader(_config.PATH_TEMPLATES, auto_reload=False)
-        compile_template = loader.load(_config.TEMPFILE_NAMELIST,
+        namelist_template = loader.load(_config.TEMPFILE_NAMELIST,
                                        cls=NewTextTemplate)
 
@@ -701,5 +701,5 @@
         maxb = int((area[0] - area[2]) / grid[0]) + 1
 
-        stream = compile_template.generate(
+        stream = namelist_template.generate(
             maxl = str(maxl),
             maxb = str(maxb),
@@ -1216,6 +1216,8 @@
         print(self.outputfilelist)
 
-        if c.format.lower() == 'grib2':
-            for ofile in self.outputfilelist:
+        for ofile in self.outputfilelist:
+            ofile = os.path.join(self.inputdir, ofile)
+
+            if c.format.lower() == 'grib2':
                 p = subprocess.check_call(['grib_set', '-s', 'edition=2, \
                                            productDefinitionTemplateNumber=8',
@@ -1223,17 +1225,14 @@
                 p = subprocess.check_call(['mv', ofile + '_2', ofile])
 
-        if c.ectrans and not c.ecapi:
-            for ofile in self.outputfilelist:
+            if c.ectrans and not c.ecapi:
                 p = subprocess.check_call(['ectrans', '-overwrite', '-gateway',
                                            c.gateway, '-remote', c.destination,
                                            '-source', ofile])
 
-        if c.ecstorage and not c.ecapi:
-            for ofile in self.outputfilelist:
+            if c.ecstorage and not c.ecapi:
                 p = subprocess.check_call(['ecp', '-o', ofile,
                                            os.path.expandvars(c.ecfsdir)])
 
-        if c.outputdir != c.inputdir:
-            for ofile in self.outputfilelist:
+            if c.outputdir != c.inputdir:
                 p = subprocess.check_call(['mv',
                                            os.path.join(c.inputdir, ofile),
Index: source/python/classes/MarsRetrieval.py
===================================================================
--- source/python/classes/MarsRetrieval.py	(revision 0e576fcaf0dab8e7e586efa1a4b9b194ee90f8bb)
+++ source/python/classes/MarsRetrieval.py	(revision 70fee58eedd41328d9f5cdc56db77e03ec78bf71)
@@ -418,5 +418,5 @@
         # open a file to store all requests to
         with open(os.path.join(inputdir,
-                                   _config.FILE_MARS_REQUESTS), 'a') as f:
+                               _config.FILE_MARS_REQUESTS), 'a') as f:
             f.write(str(request_number) + ', ')
             f.write(', '.join(str(attrs[key])
