Added logfile code