Credit Andrea for his work on the scripts.
Added ugly code to expand variables indicating the log file to be used.