Parametrised output directory.  Conditional creation of output directory.
Merge branch 'tp'