Fixed logging to logfile.txt
Small corrections