Modified to run with logfile; ther was a mistake.